Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

Any Excel Gurus out there?

Thread Tools
 
Search this Thread
 
Old 22 April 2004, 10:43 PM
  #1  
Buckrogers
Scooby Regular
Thread Starter
 
Buckrogers's Avatar
 
Join Date: Aug 2003
Posts: 2,644
Likes: 0
Received 0 Likes on 0 Posts
Default Any Excel Gurus out there?

I have some data in a single column. (Couple of thousand rows....)

I would like to be able to remove any "spaces" either before or after the actual content. Is this possible using VB or something?

I would also like to remove "*" from after say xyz123* and put it into the cell on the right of the original? (it is an actual * as opposed to wild character)
Again VB or something?

Thanks for any help in advance.

Buck
Old 23 April 2004, 01:03 AM
  #2  
Eagle7
Scooby Regular
 
Eagle7's Avatar
 
Join Date: Jan 2002
Location: Plymouth
Posts: 960
Likes: 0
Received 0 Likes on 0 Posts
Default

assuming data is in column 1 and you want the stars moving to 2 put this in a macro:

Sub StarsNSpaces()
Dim x As Integer, s As String
For x = 1 To ActiveSheet.UsedRange.Rows.Count
s = Trim(CStr(Cells(x, 1)))
If Right(s, 1) = "*" Then
Cells(x, 1) = Mid(s, 1, Len(s) - 1)
Cells(x, 2) = "*"
End If
Next x
End Sub

if you need to change it, change the start value of x (for x=1) to be the row to start processing and change the reference to cells to be the correct column : A=1, B=2, C=3 etc.
Old 23 April 2004, 06:59 AM
  #3  
Sheepsplitter
Scooby Regular
 
Sheepsplitter's Avatar
 
Join Date: Nov 2001
Posts: 1,072
Likes: 0
Received 0 Likes on 0 Posts
Default

Can't you just export it as text and read it back in using * as delimiter?
Seems like this would be a much more efficient way of achieving your requirements.
Old 10 May 2004, 12:03 AM
  #4  
Buckrogers
Scooby Regular
Thread Starter
 
Buckrogers's Avatar
 
Join Date: Aug 2003
Posts: 2,644
Likes: 0
Received 0 Likes on 0 Posts
Default

Thanks Eagle7 that was just the job.

Sheepslipper, I think you are right, but in my specific case, could have been a bit tricky with the other data that is present. Eagle7's macro does the job (thanks to copy and paste) and Eagle7's macro wisdom!

Cheers anyway.

Buck
Old 11 May 2004, 01:24 PM
  #5  
Mick
Scooby Senior
iTrader: (1)
 
Mick's Avatar
 
Join Date: Nov 1998
Posts: 2,655
Received 4 Likes on 2 Posts
Thumbs up

If you do a lot of complex Excel stuff, try this free set of tools from ASAP

http://www.asap-utilities.com/ - I found some brillliant stuff in there...

Cheers

Mick
Old 11 May 2004, 01:45 PM
  #6  
Dracoro
Scooby Regular
 
Dracoro's Avatar
 
Join Date: Sep 2001
Location: A powerslide near you
Posts: 10,261
Likes: 0
Received 0 Likes on 0 Posts
Default

you can do both without using vba.

To remove outer (left and right) spaces use excel trim function e.g. '=trim(a1)'

To split the column, select the cells to split (or the whole column) then menu Data>Text To Columns and put in * as the delimiter

easy peasy pudding and pie
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
Mattybr5@MB Developments
Full Cars Breaking For Spares
28
28 December 2015 11:07 PM
Mattybr5@MB Developments
Full Cars Breaking For Spares
12
18 November 2015 07:03 AM
leg200
Subaru Parts
5
07 October 2015 07:31 AM
has-scooby
Subaru Parts
4
06 October 2015 03:47 PM
bluebullet29
General Technical
9
05 October 2015 02:17 PM



Quick Reply: Any Excel Gurus out there?



All times are GMT +1. The time now is 05:21 PM.