Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Moving a range between sheets

Hi
I'm using Excel 2003 and am trying to move a range from one sheet to another using VBA, but I am not having a great deal of luck. In a macro I can perform what I want with this code

Sheets("Customers").Select
Range("A16:I16").Select
Selection.Copy
Sheets("CheckIn").Select
Range("A5").Select
Selection.Paste

However I wish to do this by attaching code to the click event of a button rather than a macro, using the code from the Macro in the click event will bring up a runtime error 1004 'Select method of range class failed', the problem seems to be on the Range("A16:I16").Select line. Running the Macro works fine and the data is copied over.

Thanks for any information
Jack
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 473
Default Moving a range between sheets

Jack wrote:
However I wish to do this by attaching code to the click event of a button rather than a macro,
using the code from the Macro in the click event will bring up a runtime error 1004
'Select method of range class failed',


Set the TakeFocusOnClick property of the button to False


Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - reply in newsgroup

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
Moving Data between sheets in the same workbook and moving data between Workbooks. Alison Brown Excel Worksheet Functions 0 February 10th 09 01:03 AM
Moving Between Sheets PaolaAndrea Excel Discussion (Misc queries) 1 December 2nd 08 05:15 PM
Moving through sheets izlopez Excel Discussion (Misc queries) 1 January 13th 05 08:33 PM
Macro for moving sheets minhao Excel Discussion (Misc queries) 3 December 10th 04 08:09 AM
Moving selected sheets Primoz Bradac Excel Programming 2 September 24th 03 11:41 AM


All times are GMT +1. The time now is 07:44 PM.

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"