If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Split

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-08-07, 08:30
dimis2500 dimis2500 is offline
Registered User
 
Join Date: Jan 2005
Posts: 362
Split

I have an excel db with a field "Surname & Name", I want to split Surname and Name and the Name to be at a separate Column the L for example.
I use this code
Code:
sub sep_name()
Dim x
Worksheets("Sheet1").Range("A1").Activate  
  iRow = 0
Do Until 1 = 0 'Endless Loop!
   iRow = iRow + 1
   If ActiveCell.Offset(iRow, 1).Value <> "" Then
      x = Split(ActiveCell.Offset(iRow, 1).Value, " ")
    ActiveCell.Offset(iRow, 11).Value = x(1)
  Else
       Exit Do
  End If  
Loop
End Sub
But this code do that I want only for the first 30-40 fields but there are at least another 40 fields and with that do nothing!
What is wrong, is there another better solution?
Reply With Quote
  #2 (permalink)  
Old 08-08-07, 08:54
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
If you only want to do it for the first 40 rows change the Do Until to read
Code:
Do Until iRow = 40
__________________
George
Twitter | Blog
Reply With Quote
  #3 (permalink)  
Old 08-08-07, 09:00
dimis2500 dimis2500 is offline
Registered User
 
Join Date: Jan 2005
Posts: 362
Solution

I copy paste this sheet at another sheet it was ok , Someone made a deletion of some names.
I do not know if it counts.
Thank you, I will count this solution.
I thing I will be ok now.
Dimis
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On