macro sheet position

J

jay d

I have this code below. i want it to perform a task on project lis
sheet while the button to execute the code is on another sheet, but it
executing the task on the same sheet the button is on, hence taking th
wrong data. what am i missing from the code?

Code
-------------------
Sub smi()
'
' smi Macro
'
Range("A4:A" & Range("A3").End(xlDown).Row & ",D4:E" & Range("A3").End(xlDown).Row).Select
Selection.Copy
Sheets("Project List").Select
Range("A" & ((Range("A3").End(xlDown).Row) + 1)).Select
ActiveSheet.Paste

End Su
-------------------


thanks

Jami
 
A

Arvi Laanemets

Hi

....
Sheets(SourceSheet).Range(SourceRange).Copy
Sheets(TargetSheet).Range(TargetRange).Paste
....

(no need to activate/select any sheet when doing copy/paste - so it works
much faster and the screen isn't blinking too)
 
J

jay d

thanks

im not really a competant coder, i replaced what i had with what yo
said but it does not work, is it the wrong order?


Code
-------------------
Sub smi()
'
' smi Macro
' Macro recorded 26/05/2006 by jharri4
'

'
Range("A4:A" & Range("A3").End(xlDown).Row & ",D4:E" & Range("A3").End(xlDown).Row).Select
Selection.Copy
Sheets("SMI Project List").Select
Range("A" & ((Range("A3").End(xlDown).Row) + 1)).Select
Sheets("SMI Indicators").Range("A4:A" & Range("A3").End(xlDown).Row & ",D4:E" & Range("A3")).Copy
Sheets("SMI Project List").Range("A4:A" & Range("A3").End(xlDown).Row & ",D4:E" & Range("A3")).Paste

End Su
-------------------


it was saying there is a problem with line 5, the copy line...

Jami
 
Top