Hi Folks,
I'm trying to use the below code:
I'm getting runtime error in "Selection.SpecialCells(xlCellTypeBlanks).Select" step which is normal but I have also used Error handler to skip this step.
For some reason error handler is not behaving the same way it should.Its not going to the NextStep3: . But here is the catch...i have used error handler twice more in the same module
before this code and it's working fine. And when I'm trying to run the above code in a different module also it works fine.
Any assistance would be appriciated.
Thanks
I'm trying to use the below code:
Rich (BB code):
sub main()
.....
.....
Windows(e).Activate
Columns("A:A").Select
Selection.ClearContents
Windows(n).Activate
lRow = Range("AD" & Rows.Count).End(xlUp).Row
Range("AD2:AD" & lRow).Copy
Windows(e).Activate
Range("A1").PasteSpecial xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
On Error GoTo NextStep3
Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.Delete Shift:=xlUp
NextStep3:
iRow = 0
While Sheets(1).Cells(iRow + 1, 1) <> ""
Criteria_Val(iRow) = Sheets(1).Cells(iRow + 1, 1)
iRow = iRow + 1
Wend
Workbooks("Reference Data").Sheets("OSPD CC List").Range("A1:X1").AutoFilter Field:=3, Criteria1:=Criteria_Val, Operator:=xlFilterValues
Windows(k).Activate
Sheets("OSPD CC List").Activate
Lrow1 = Range("C" & Rows.Count).End(xlUp).Row
Set qRng = Range("Q1:Q" & Lrow1)
Set sRng = Range("S1:S" & Lrow1)
Set uRng = Union(qRng, sRng)
uRng.Copy
Windows(n).Activate
Range("BQ1").Select
ActiveSheet.Paste
Windows(k).Activate
Selection.AutoFilter
End Sub
For some reason error handler is not behaving the same way it should.Its not going to the NextStep3: . But here is the catch...i have used error handler twice more in the same module
before this code and it's working fine. And when I'm trying to run the above code in a different module also it works fine.
Any assistance would be appriciated.
Thanks
Last edited by a moderator: