Method 'range' of object'_global' failed

Microsoft Excel 2003 (full product)
January 21, 2011 at 01:18:08
Specs: Windows XP
Why am I getting the Run-time error '1004' for the below code in a macro?

If Range(Chr(colRng) & rw) <> "" Or _
Range(Chr(colRng) & rw + 1) <> "" Then

Many thanks,


See More: Method range of object_global failed

Report •


#1
January 21, 2011 at 01:20:03
Full code;

Sub Hide_Blank_Rows
Dim rw, colChkCode, colRng As Integer
Dim colChk As String
Dim xlCalc As XlCalculation
xlCalc = Application.Calculation
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
Application.EnableEvents = False
colChk = _
Application.InputBox _
("Which Period (Column letter) are you reporting on?", _
Title:="Column Check", Type:=2)
If colChk = "False" Then Exit Sub
colChkCode = Asc(UCase(colChk))
For rw = 6 To 3000 Step 6
For colRng = colChkCode To colChkCode + 6
If Range(Chr(colRng) & rw) <> "" Or _
Range(Chr(colRng) & rw + 1) <> "" Then
GoTo NotAllBlank
End If
Next
Range(Chr(colChkCode) & rw & ":" & _
Chr(colChkCode) & rw + 5).EntireRow.Hidden = True
NotAllBlank:
Next
Application.Calculation = xlCalc
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub


Report •
Related Solutions


Ask Question