ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Why does this simple thing not work? (https://www.excelbanter.com/excel-programming/340836-why-does-simple-thing-not-work.html)

Peter[_55_]

Why does this simple thing not work?
 
Hi,

This is a very simple thing, so i tought, but it just keeps giving an error.

Private Sub CommandButton1_Click()
'BUTTON SAVE
ActiveSheet.Range("M5").Copy
Worksheets("Historiek").Select
Range("D3").Paste
End Sub

Can anyone tell me why or what it is i'm doing wrong?

Regards,
Peter



Jim Cone

Why does this simple thing not work?
 
Peter,
Additional information could help to answer your question...
What version of Excel are you using?
What is the error number and text?
On what code line does the error occur?
Is the Command button on a Worksheet, Chart or a UserForm?

Making a swag, try setting the "Take Focus on Click" property of
the command button to False.
Jim Cone
San Francisco, USA


"Peter"
wrote in message

Hi,
This is a very simple thing, so i tought, but it just keeps giving an error.

Private Sub CommandButton1_Click()
'BUTTON SAVE
ActiveSheet.Range("M5").Copy
Worksheets("Historiek").Select
Range("D3").Paste
End Sub

Can anyone tell me why or what it is i'm doing wrong?
Regards,
Peter



Bruno Campanini[_3_]

Why does this simple thing not work?
 
"Peter" wrote in message
...
Hi,

This is a very simple thing, so i tought, but it just keeps giving an
error.

Private Sub CommandButton1_Click()
'BUTTON SAVE
ActiveSheet.Range("M5").Copy
Worksheets("Historiek").Select
Range("D3").Paste
End Sub

Can anyone tell me why or what it is i'm doing wrong?

Regards,
Peter


Activate auto-record a macro to see the correct
sintax:

Range("M5").Select
Selection.Copy
Sheets("Historiek").Select
Range("D3").Select
ActiveSheet.Paste





Peter[_55_]

Why does this simple thing not work?
 
Thx for all your help guys, everything works now.
You're great ;-)

Greets,
Peter
"john" schreef in bericht
...
On Thu, 22 Sep 2005 14:57:32 GMT, "Peter" wrote:

Hi,

This is a very simple thing, so i tought, but it just keeps giving an
error.

Private Sub CommandButton1_Click()
'BUTTON SAVE
ActiveSheet.Range("M5").Copy
Worksheets("Historiek").Select
Range("D3").Paste
End Sub

Can anyone tell me why or what it is i'm doing wrong?

Regards,
Peter



change

Range("D3").Paste

to

Range("D3").select
activesheet.Paste


Or, just do this


Range("M5").Copy Sheets("Historiek").Range("D3")

and it'll paste it to D3 on Historiek

john





All times are GMT +1. The time now is 06:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com