Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default why don't buttons work?

Try something like this instead:
Sheets("SHIFTS").Range("A20:C28").Value = Sheets
("A3").Range("D1:F9").Value

-----Original Message-----
Hello there

I recorded a macro to copy cells from one sheet and put
them onto another sheet.
I then used a button on the destination sheet to call the
macro. All was working ok, but the macro code was very
long so I removed unecessary bits and got it down from 6
lines to 1.
This one line of code works when I step through the

macro,
but produces an error when I call it from the button.

The original code was this, as recorded by the macro and
which worked when called by the button on the sheet.
Sheets("A3").Select
Range("D1:F9").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("SHIFTS").Select
Range("A20").Select
ActiveSheet.Paste

I then reduced this to one line which works when I step
through the code, but produces an error message "Copy
method of Range Class failed" when called by the button.

Sheets("A3").Range("D1:F9").Copy Sheets("SHIFTS").Range
("A20")

I'm running exel 97

Any comments much appreciated!
.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 576
Default thanks Mike!

Just to add. On the destination - you only need to specify a single cell.
This avoids the problem of matching areas.

Sheets("SHIFTS").Range("A20:C28").Value = _
Sheets("A3").Range("D1").Value

steve

"NFI" wrote in message
...
Thanks for that, it's working a treat and doesn't copy the
formatting either, meaning I can do away with the unmerge
cells code later on.
-----Original Message-----
Try something like this instead:
Sheets("SHIFTS").Range("A20:C28").Value = Sheets
("A3").Range("D1:F9").Value

-----Original Message-----
Hello there

I recorded a macro to copy cells from one sheet and put
them onto another sheet.
I then used a button on the destination sheet to call

the
macro. All was working ok, but the macro code was very
long so I removed unecessary bits and got it down from 6
lines to 1.
This one line of code works when I step through the

macro,
but produces an error when I call it from the button.

The original code was this, as recorded by the macro and
which worked when called by the button on the sheet.
Sheets("A3").Select
Range("D1:F9").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("SHIFTS").Select
Range("A20").Select
ActiveSheet.Paste

I then reduced this to one line which works when I step
through the code, but produces an error message "Copy
method of Range Class failed" when called by the button.

Sheets("A3").Range("D1:F9").Copy Sheets("SHIFTS").Range
("A20")

I'm running exel 97

Any comments much appreciated!
.

.



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
For that the buttons do not work of reordering, in the panel of s. Henry Excel Discussion (Misc queries) 3 May 2nd 07 08:08 PM
rigth click and some buttons from toolbar does not work Fabian Alfonso Excel Discussion (Misc queries) 1 November 2nd 06 09:38 PM
New Buttons dont work after I put them in the toolbar Dave in Nashville New Users to Excel 2 June 22nd 06 05:25 PM
buttons dont seem to work after I put them into the toolbar Dave in Nashville Excel Discussion (Misc queries) 1 June 22nd 06 06:47 AM
can you put radio buttons into an excel work sheet? and how? laura Excel Worksheet Functions 1 December 22nd 05 01:41 PM


All times are GMT +1. The time now is 04:09 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"