PDA

View Full Version : Need a macro to copy data to main file



alan_ay
09-20-2009, 09:54 PM
I need to write a macro shift the data from various file to a main file.
For example, shift the data in aa(C2:C21) to the B column of ss which the top cell is B5.

Thank You

Bob Phillips
09-21-2009, 01:27 AM
Is ss a different workbook from tha main data? Is it open? if not, is it in a fixed directory?

alan_ay
09-21-2009, 06:02 PM
ss a different workbook. ss is in a fixed directory. Thank you.

Bob Phillips
09-22-2009, 01:07 AM
Copying the data is simple



With Activesheet

If .Range("A1").Value = "" Then

NextRow = 1
ElseIf .Range("A2").Value = "" Then

NextRow = 2
Else

NextRow = .Range("A1").End(xlDown).Row + 1
End If

'then use NextRow to as the copy to row


If ss is closed you will need to open it.

alan_ay
09-22-2009, 07:28 PM
Thanks for your help