See if this from OTTO MOEHRBACK can helip you
QUOTE
Here is a macro that will do what you want. For this macro to operate
correctly the following conditions must exist:
The active sheet is the sheet that contains your raw data.
The raw data is in Columns A:C as you said.
There must a list of all the sheet names in some column of some sheet in
your file and that list must be named "SheetList".
Note that this macro copies Columns B:C and pastes that data into Column A
of the appropriate sheets.
Sub CopyData()
Dim ShtName As Range
Dim RngColA As Range
Dim i As Range
Dim Dest As Range
Set RngColA = Range("A2", Range("A" & Rows.Count).End(xlUp))
For Each ShtName In Range("SheetList")
With Sheets(ShtName.Value)
Set Dest = .Range("A" & Rows.Count).End(xlUp).Offset(1)
For Each i In RngColA
If Left(i, Len(ShtName.Value)) = ShtName.Value Then
i.Offset(, 1).Resize(, 2).Copy Dest
Set Dest = Dest.Offset(1)
End If
Next i
End With
Next ShtName
End Sub
OTTO MOEHRBACK
UNQUOTE
--
Robert
"dhuto777 via OfficeKB.com" wrote:
Dearest All,
I am new to VBA. So please be patient with me.
I am learning how to write macros. However i am stuck in this area:
Given a set of data (Eg,By Group, By GDP) in Sheet1, I wish to copy 1 group
(Eg.Singapore) and GDP figures into a new worksheet named after Singapore.
What must I do?
Thank you
Lee Coh
--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200607/1