PC Review


Reply
Thread Tools Rate Thread

Data Split and sort problem

 
 
joecrabtree
Guest
Posts: n/a
 
      20th Dec 2006
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

 
Reply With Quote
 
 
 
 
joecrabtree
Guest
Posts: n/a
 
      20th Dec 2006
Perfect. Many Thanks.

On Dec 20, 3:30 pm, John Bundy <Xjmbu...@gmailX.com 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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Split form to table data problem... Scott McDaniel Microsoft Access 0 27th Jul 2009 08:05 PM
Sort addresses for data split =?Utf-8?B?UmVhbEdvbWVy?= Microsoft Excel Misc 3 26th Jan 2007 11:29 PM
Data Split and graph problem joecrabtree Microsoft Excel Programming 8 13th Dec 2006 06:25 PM
Split database data entry problem =?Utf-8?B?VE9NQUM=?= Microsoft Access Database Table Design 5 24th Oct 2005 05:12 PM
problem with data.Split(vbCrLf) Ron Microsoft VB .NET 8 10th Jan 2005 04:37 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:25 AM.