ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy and paste code (https://www.excelbanter.com/excel-programming/374965-copy-paste-code.html)

Rayo K

Copy and paste code
 
I can't seem to get this code to work. I am trying to set up a spreadsheet
that copys a range from one sheet and adds to the values on an identical
sheet. The problem is some of the cells are merged and my code unmerges them,
despite that when I do it manually, it works. Here is my code:

Sheets("Entry").Activate
Range("B5:Q13").Copy
Sheets("Total").Activate
Range("B5:Q13").PasteSpecial Paste:=xlPasteAll, Operation:=xlAdd,
SkipBlanks:= _
False, Transpose:=False

Sheets("Entry").Activate
Range("T5:AG13").Copy
Sheets("Total").Activate
Range("T5:AG13").PasteSpecial Paste:=xlPasteAll, Operation:=xlAdd,
SkipBlanks:= _
False, Transpose:=False


Basically I am tallying the numbers that are entered in the first sheet.
Please help.

Don Guillett

Copy and paste code
 
Sub Macro5() 'recorded
'
' Macro5 Macro
' Macro recorded 10/12/2006 by Don Guillett
'

'
Range("A1:E9").Select
Selection.Copy
Sheets("Sheet8").Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteAllExceptBorders,
Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Range("B13").Select
End Sub

cleaned up
Sub Macro5a()
Sheets("sheet7").Range("A1:E9").Copy
Sheets("Sheet8").Range("A1").PasteSpecial _
Paste:=xlPasteAllExceptBorders
End Sub

--
Don Guillett
SalesAid Software

"Rayo K" wrote in message
...
I can't seem to get this code to work. I am trying to set up a spreadsheet
that copys a range from one sheet and adds to the values on an identical
sheet. The problem is some of the cells are merged and my code unmerges
them,
despite that when I do it manually, it works. Here is my code:

Sheets("Entry").Activate
Range("B5:Q13").Copy
Sheets("Total").Activate
Range("B5:Q13").PasteSpecial Paste:=xlPasteAll, Operation:=xlAdd,
SkipBlanks:= _
False, Transpose:=False

Sheets("Entry").Activate
Range("T5:AG13").Copy
Sheets("Total").Activate
Range("T5:AG13").PasteSpecial Paste:=xlPasteAll, Operation:=xlAdd,
SkipBlanks:= _
False, Transpose:=False


Basically I am tallying the numbers that are entered in the first sheet.
Please help.





All times are GMT +1. The time now is 03:22 AM.

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