Pat_The_Bat
Board Regular
- Joined
- Jul 12, 2018
- Messages
- 83
When I step through this sub, all of a sudden now it is triggering the Selection Change Sub I just made. This code was working fine. Now its not working and when I try to debug I see it jumping over to the Selection_Change Sub.
Anybody know why it keeps jumping over to that Sub?
Headscratcher
Anybody know why it keeps jumping over to that Sub?
Headscratcher
Code:
Sub AddAssetDocs()
With Sheets("Assets")
On Error GoTo err_msg
Dim Ncol As String
Dim Zcol As String
Dim CpRange As Range
Ncol = .Range("N5:N500").SpecialCells(xlConstants).Address
Debug.Print Ncol
Zcol = .Range(Ncol).Offset(, 12).Address
Debug.Print Zcol
On Error GoTo err_msg
CpRange = .Range(Zcol).SpecialCells(xlBlanks).Address
Debug.Print CpRange
If CpRange = 0 Then GoTo Skiptohere
.Range(CpRange).Offset(, 1).Copy
End With
Sheets("Doc Checklist").visible=True
With Worksheets("Doc Checklist")
LstRow = .Range("D" & .Rows.Count).End(xlUp).Row + 1
'fill next available cell with a new data
.Range("D" & LstRow).PasteSpecial xlPasteValues
End With
'once again, using cprange we mark rows which have been copied to "Doc Checklist"
With Sheets("Assets")
.Range(CpRange).Value = "x"
End With
Application.CutCopyMode = False
MsgBox "These Documents have been added to the Doc Checklist"
GoTo Skiptohere
err_msg:
MsgBox "There are no new Docs to add to the list"
Skiptohere:
Worksheets("Assets").Select
Worksheets("Assets").Range("B1").Select
Application.CutCopyMode = False
With Sheets("Doc Checklist")
.Range("C2:C500").Sort Key1:=.Range("C2"), order1:=xlAscending, Header:=xlNo
End With
Worksheets("Doc Checklist").Range("D2:D100").Copy Worksheets("Doc Request").Range("I4:I100")
Sheets("Doc Checklist").visible= False
End Sub