Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
jay d
 
Posts: n/a
Default macro sheet position


I have this code below. i want it to perform a task on project list
sheet while the button to execute the code is on another sheet, but its
executing the task on the same sheet the button is on, hence taking the
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 Sub
--------------------


thanks

Jamie


--
jay d
------------------------------------------------------------------------
jay d's Profile: http://www.excelforum.com/member.php...o&userid=34487
View this thread: http://www.excelforum.com/showthread...hreadid=548522

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Arvi Laanemets
 
Posts: n/a
Default macro sheet position

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)


--
Arvi Laanemets
( My real mail address: arvi.laanemets<attarkon.ee )



"jay d" wrote in
message ...

I have this code below. i want it to perform a task on project list
sheet while the button to execute the code is on another sheet, but its
executing the task on the same sheet the button is on, hence taking the
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 Sub
--------------------


thanks

Jamie


--
jay d
------------------------------------------------------------------------
jay d's Profile:
http://www.excelforum.com/member.php...o&userid=34487
View this thread: http://www.excelforum.com/showthread...hreadid=548522



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
jay d
 
Posts: n/a
Default macro sheet position


thanks

im not really a competant coder, i replaced what i had with what you
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 Sub
--------------------


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

Jamie


--
jay d
------------------------------------------------------------------------
jay d's Profile: http://www.excelforum.com/member.php...o&userid=34487
View this thread: http://www.excelforum.com/showthread...hreadid=548522

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Asked previously...can this not be done in excel simonsmith Excel Discussion (Misc queries) 2 May 16th 06 11:50 PM
Compiling macro based on cell values simonsmith Excel Discussion (Misc queries) 1 May 16th 06 08:31 PM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
Relative Cell position NOT working with or without macro Scratching my Head Excel Discussion (Misc queries) 6 May 30th 05 06:12 PM
2 questions, copying data from sheet to sheet and assigning macro Boris Excel Worksheet Functions 0 December 16th 04 06:11 PM


All times are GMT +1. The time now is 08:56 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"