ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy, paste to another sheet (https://www.excelbanter.com/excel-programming/326689-copy-paste-another-sheet.html)

HrvojeZagi

Copy, paste to another sheet
 
Hi,

I would like to copy, paste data from one sheet to another sheet.
I have made command button with this code, and it doesn't work. If someone
can help?

Range("A4:C4").Select
Selection.Copy
Sheets("Data").Select
Range("A2").Select ' code stops on this sentence (even if I put range
A2:C2)
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False

Thanks in advance



Tom Ogilvy

Copy, paste to another sheet
 
Sheets("Data").Range("A2:C2").Value = Sheets("Sheet1").Range("A4:C4").Value

Adjust sheet names to match yours.

--
Regards,
Tom Ogilvy

"HrvojeZagi" wrote in message
...
Hi,

I would like to copy, paste data from one sheet to another sheet.
I have made command button with this code, and it doesn't work. If someone
can help?

Range("A4:C4").Select
Selection.Copy
Sheets("Data").Select
Range("A2").Select ' code stops on this sentence (even if I put

range
A2:C2)
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False

Thanks in advance





Tom Ogilvy

Copy, paste to another sheet
 
If you prefer to go with your current code


Private Sub CommandButton1_Click()
Range("A4:C4").Select
Selection.Copy
Sheets("Data").Select
ActiveSheet.Range("A2").Select
Selection.PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, SkipBlanks:=False, _
Transpose:=False
End Sub


--
Regards,
Tom Ogilvy




"HrvojeZagi" wrote in message
...
Hi,

I would like to copy, paste data from one sheet to another sheet.
I have made command button with this code, and it doesn't work. If someone
can help?

Range("A4:C4").Select
Selection.Copy
Sheets("Data").Select
Range("A2").Select ' code stops on this sentence (even if I put

range
A2:C2)
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False

Thanks in advance





Patrick Molloy

Copy, paste to another sheet
 
use this method if you want formats and values:

Range("A4:C4").Copy
With Sheets("Data").Range("A2")
.PasteSpecial xlPasteAll
.Value = .Value ' omit to keep formulae
End With

Use Tom's method to copy just values...
Sheets("Data").Range("A2:C4").Value = Range("A4:C4").Value




"HrvojeZagi" wrote in message
...
Hi,

I would like to copy, paste data from one sheet to another sheet.
I have made command button with this code, and it doesn't work. If someone
can help?

Range("A4:C4").Select
Selection.Copy
Sheets("Data").Select
Range("A2").Select ' code stops on this sentence (even if I put
range
A2:C2)
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False

Thanks in advance






All times are GMT +1. The time now is 10:37 PM.

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