Rubber Beaked Woodpecker
Board Regular
- Joined
- Aug 30, 2015
- Messages
- 205
- Office Version
- 2021
Hi all
The following code works very well
However I would like to to add this extra piece of code but cannot get this to work.
This extra piece of code will be executed after the original code has run.
Thanks
RBW
The following code works very well
VBA Code:
Sub logBalance()
Dim source As Worksheet
Dim destination As Worksheet
Dim emptyColumn As Long
Set source = Sheets("Sheet8")
Set destination = Sheets("Sheet1")
source.Range("D28:D55").Copy
emptyColumn = destination.Cells(2, destination.Columns.Count).End(xlToLeft).Column
If IsEmpty(destination.Range("D2")) 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.Range("X3").Copy
emptyColumn = destination.Cells(31, destination.Columns.Count).End(xlToLeft).Column
If IsEmpty(destination.Range("D2")) Then
destination.Cells(1, 1).PasteSpecial Transpose:=True
Else
emptyColumn = emptyColumn + 1
destination.Cells(31, emptyColumn).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End If
End If
End Sub
However I would like to to add this extra piece of code but cannot get this to work.
VBA Code:
source.Range("D28:D55").Select
Selection.Delete Shift:=xlToLeft
This extra piece of code will be executed after the original code has run.
Thanks
RBW