Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Runtime Error 1004 - Help
Hi, I am having a little trouble with this code. It produces a runtime
error 1004 in VBA. I think it is coming from this line of code. Would appreciate any help with this. Thanks, Dean If Not rng Is Nothing Then rng.EntireRow.Hidden = True Sub Macro4() Dim Lrow As Long Dim CalcMode As Long Dim StartRow As Long Dim EndRow As Long Dim rng As Range With Application CalcMode = .Calculation .Calculation = xlCalculationManual .ScreenUpdating = False End With Msg = "Please Check You Have Loaded The Label Paper Correctly - " & vbCr & "Labels Will Be Sent To Printer - All Data Will Be Deleted " & vbCr & vbCr & "Click OK When You Are Ready To Proceed" MsgBox Prompt:=Msg With ActiveSheet .DisplayPageBreaks = False StartRow = 2 EndRow = 5000 For Lrow = StartRow To EndRow Step 1 If IsError(.Cells(Lrow, "B").Value) Then 'Do nothing, This avoid a error if there is a error in the cell ElseIf .Cells(Lrow, "B").Value = "0" Then If rng Is Nothing Then Set rng = .Cells(Lrow, "B") Else Set rng = Application.Union(rng, .Cells(Lrow, "B")) End If End If Next End With 'hide all rows in one time If Not rng Is Nothing Then rng.EntireRow.Hidden = True With Application .ScreenUpdating = True .Calculation = CalcMode Application.Run Macro:="Macro5" rng.EntireRow.Hidden = False End With End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Runtime Error 1004 | Excel Discussion (Misc queries) | |||
runtime error 1004 | Excel Discussion (Misc queries) | |||
runtime error 1004 | Excel Discussion (Misc queries) | |||
Excel 2003 Macro Error - Runtime error 1004 | Excel Discussion (Misc queries) | |||
Runtime error 1004 | Excel Programming |