View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default Macro-indirect cell

You could and should use a data validation dropdown list in cell m1 so you
don't have to type it

Sub copySAS()
Dim LR As Long
With Sheets(Range("m1").Value)
lr = .Cells(Rows.Count, 1).End(xlUp).Row
Worksheets("Sheet1").UsedRange.Copy .cells(lr,1)
End With
end sub



--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"puiuluipui" wrote in message
...
Hi, i have this code:

Sub copy1()
Dim lastRow As Long
lastRow = Worksheets("Sheet2").Cells(Worksheets("Sheet2").Ro ws.Count,
"A").End(xlUp).Row
Worksheets("Sheet1").UsedRange.Copy
Worksheets("Sheet2").Activate
Range("A" & (lastRow + 1)).Select
ActiveSheet.Paste
End Sub

Can this code be made to copy rows to a specific sheet?
In "M1" i will write october, so when i run macro, the code to copy rows
to
"october" sheet. If i write november, then the code to copy rows to
"november" sheet.
Can this be done?
Thanks!