Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default Data Split and sort problem

To all,

I have a list of data in column A: eg:

L1
L2
M2
M7
H7
H10
L6
L8
M6
M99

etc

I want to be able to split the data in column A into three columns:

All the data starting with 'L' in column B, i.e. L1,L2, L6,L8
All the data starting with 'M' in column C i.e., M2, M7, M6
All the data starting with 'H' in column D i.e. H10

I would like the data to be sorted in each column. Can this be done
using a macro?

Thanks for all your help in advance,

Kind Regards

Joseph Crabtree

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default Data Split and sort problem

Perfect. Many Thanks.

On Dec 20, 3:30 pm, John Bundy remove X''''s
wrote:
You can sort the column before then add this to code it will do them in
order. This assumes there are no blanks in column A

Sub main()
Dim myRow, bRow, cRow, dRow As Integer
bRow = 1
cRow = 1
dRow = 1
myRow = 1

Do Until Cells(myRow, 1) = ""
If Left(Cells(myRow, 1), 1) = "L" Then
Cells(bRow, 2) = Cells(myRow, 1)
bRow = bRow + 1
End If

If Left(Cells(myRow, 1), 1) = "M" Then
Cells(cRow, 3) = Cells(myRow, 1)
cRow = cRow + 1
End If

If Left(Cells(myRow, 1), 1) = "H" Then
Cells(dRow, 4) = Cells(myRow, 1)
dRow = dRow + 1
End If

myRow = myRow + 1
Loop

End Sub

--
-John
Please rate when your question is answered to help us and others know what
is helpful.



"joecrabtree" wrote:
To all,


I have a list of data in column A: eg:


L1
L2
M2
M7
H7
H10
L6
L8
M6
M99


etc


I want to be able to split the data in column A into three columns:


All the data starting with 'L' in column B, i.e. L1,L2, L6,L8
All the data starting with 'M' in column C i.e., M2, M7, M6
All the data starting with 'H' in column D i.e. H10


I would like the data to be sorted in each column. Can this be done
using a macro?


Thanks for all your help in advance,


Kind Regards


Joseph Crabtree- Hide quoted text -- Show quoted text -


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sort addresses for data split RealGomer Excel Discussion (Misc queries) 3 January 26th 07 11:29 PM
Data Split and graph problem joecrabtree Excel Programming 8 December 13th 06 06:25 PM
Split cell info via VB problem BEEJAY Excel Programming 3 September 20th 06 01:16 PM
Formula Split or parenthesis problem? nastech Excel Discussion (Misc queries) 0 January 16th 06 12:59 AM
Excel split window refresh problem david Excel Programming 5 September 9th 05 02:20 PM


All times are GMT +1. The time now is 01:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"