Rubber Beaked Woodpecker
Board Regular
- Joined
- Aug 30, 2015
- Messages
- 205
- Office Version
- 2021
The following code works very well but it run a couple of hundred times a day and each my pc cpu is briefly 100%
Anyone think that it could be written in a more efficient way to save my pc pls?
Anyone think that it could be written in a more efficient way to save my pc pls?
VBA Code:
Sub Reports()
Dim source As Worksheet
Dim destination As Worksheet
Dim emptyColumn As Long
Set source = Sheets("Sheet1")
Set destination = Sheets("Sheet8")
source.Range("Z2:Z40").Copy
emptyColumn = destination.Cells(28, destination.Columns.Count).End(xlToLeft).Column
If IsEmpty(destination.Range("A28")) Then
destination.Cells(1, 1).PasteSpecial Transpose:=True
Else
emptyColumn = emptyColumn + 1
destination.Cells(28, emptyColumn).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
destination.Cells(28, emptyColumn).PasteSpecial Paste:=xlPasteFormats
End If
End Sub