Run-time Error 40036 on ActiveSheet

B

Brent Fidler

I get a Run-time error 40036 after the .Rows(STARTROW).Insert in this code


Public Sub HideBlanksAndZeros2()
Const MYCOL As String = "J"
Const STARTROW As Long = 8
Dim rng As Range

Application.ScreenUpdating = False
With ActiveSheet
.Rows(STARTROW).Insert
.UsedRange
With Intersect(.Cells(STARTROW, MYCOL).Resize(Rows.count - _
STARTROW), .UsedRange)
.AutoFilter Field:=1, Criteria1:="=", _
Operator:=xlOr, Criteria2:="=0"
On Error Resume Next
Set rng = .SpecialCells(xlCellTypeVisible)
On Error GoTo 0
.AutoFilter Field:=1
End With
End With
If Not rng Is Nothing Then rng.EntireRow.Hidden = True
ActiveSheet.Rows(STARTROW).Delete
Application.ScreenUpdating = True
End Sub



Any clues as to why?
 
N

Norman Jones

Hi Brent,

I was able to run the relevant portion of code without problem.Despite
trying everything I could think of that might cause a problem, I was unable
to replicate your error.

Sorry for my unhelpful reponse.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top