Hi,
I've been trying to figure out what could be wrong with my code. I tried all I can search to update the code seems the same error.
This are my code
Sub Consolidate ()
On error GoTo 0
Dim Destrange as range
Dim DestWB as workbook
Dim DestSh as worksheet
Dim Lr as long
With application
. ScreenUpdating = False
. EnableEvents = False
End with
If bISBookOpen_RB("pathfolder.xlsx" ) Then
Set DestWB = Workbooks(" pathfolder.xlsx")
Else
Set DestWB = Workbooks.Open("pathfolder.xlsx")
End If
Set ws1 = This Workbook.ActiveSheet
Set rg1 = ws1.Range ("A2:K2")
Set DestWB = Workbooks.Open("pathfolder.xlsx")
Lr = Last(1, DestRange)
Set DestRange = DestSh.Range("A" & DestWB.Worksheets("Data").Rows.Count.End(xlUp)
Set DestSh = Dest.Range("A2")
Do until IsEmpty(DestSh)
Set DestSh = DestRange.offset(1, 0)
Loop
With Rg1
. Select
. Copy
Endwith
With DestSh
DestRange.PasteSpecial _
Paste:=xlPasteValues, _
operation:=xlPasteSpecialOperationNone, _
skipblanks:=False, _
Transpose:=False
End With
Else
End If
Exit Sub
DestWB.Close Savechanges:= True
With application
. ScreenUpdating = True
. EnableEvents = True
End With
End Sub
With this code
Set DestRange = DestSh.Range("A" & DestWB.Worksheets("Data").Rows.Count.End(xlUp)
Set DestSh = Dest.Range("A2")
This two is highlighted in yellow and shows DestRange=Nothing DestSh = nothing
Your help will be highly appreciated
Thank you in advance