Rubber Beaked Woodpecker
Board Regular
- Joined
- Aug 30, 2015
- Messages
- 205
- Office Version
- 2021
Currently I use the following code that works very well but I would like to tidy it a little so that instead of calling Macro1 the code in Macro1 will be incorporated in to the original code.
However no matter what I try I get a 400 error!
Any help please
RBW
However no matter what I try I get a 400 error!
Any help please
RBW
VBA Code:
Sub Report()
Dim source As Worksheet
Dim destination As Worksheet
Dim emptyColumn As Long
Set source = Sheets("Sheet1")
Set destination = Sheets("Sheet8")
source.Range("BG4:BG230").Copy
emptyColumn = destination.Cells(2, destination.Columns.Count).End(xlToLeft).Column
If IsEmpty(destination.Range("A2")) Then
destination.Cells(1, 1).PasteSpecial Transpose:=True
Else
emptyColumn = emptyColumn + 1
destination.Cells(2, emptyColumn).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
destination.Cells(2, emptyColumn).PasteSpecial Paste:=xlPasteFormats
Sheets("Sheet8").Select
Call Macro1
End If
End Sub
VBA Code:
Sub Macro1()
'
' Macro1 Macro
'
'
Range( _
"A1:C246,D235:X246,D209:X220,D175:X194,D142:X153,D112:X127,D83:X94"). _
Select
Range("D83").Activate
Sheets("Sheet8").Select
ActiveSheet.Calculate
End Sub