J
jfcby
Hello,
With the following macro code (a work in progress) I'm getting this
error massage: "Method Range of Object Failed" at the following line:
"MsgBox Range(Cr)".
What part of this macro needs to be modified so that I don not get
this error message?
Sub WorkSheetPageSetup()
'Setup WorkSheet PAGE for Zones
'1. Fill ColumnB with color Light Grey - value 001
'2. or Fill ColumnD with color Light Grey - value Left("BLDG")
Dim LastRow As Long
Dim i As Integer
Dim Cr As String
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
Application.ScreenUpdating = False
For i = 5 To Worksheets.Count
For Each cell In Range("A4:A" & LastRow)
If cell.Offset(, 1).Value = "001" Or Left(cell.Offset(,
3).Value, 4) = "BLDG" Then
Ca = cell.Address
Coa = cell.Offset(, 6).Address
Cr = Chr(34) & Mid(Ca, 2, 1) & Right(Ca, 1) & ":" & Mid(Coa,
2, 1) & Right(Coa, 1) & Chr(34)
MsgBox ActiveWorkbook.Name
MsgBox Chr(34) & Mid(Ca, 2, 1) & Right(Ca, 1) & ":" & Mid(Coa,
2, 1) & Right(Coa, 1) & Chr(34)
MsgBox Range(Cr)
End If
Next cell
Next i
Application.ScreenUpdating = True
End Sub
Thank you for your help,
jfcby
With the following macro code (a work in progress) I'm getting this
error massage: "Method Range of Object Failed" at the following line:
"MsgBox Range(Cr)".
What part of this macro needs to be modified so that I don not get
this error message?
Sub WorkSheetPageSetup()
'Setup WorkSheet PAGE for Zones
'1. Fill ColumnB with color Light Grey - value 001
'2. or Fill ColumnD with color Light Grey - value Left("BLDG")
Dim LastRow As Long
Dim i As Integer
Dim Cr As String
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
Application.ScreenUpdating = False
For i = 5 To Worksheets.Count
For Each cell In Range("A4:A" & LastRow)
If cell.Offset(, 1).Value = "001" Or Left(cell.Offset(,
3).Value, 4) = "BLDG" Then
Ca = cell.Address
Coa = cell.Offset(, 6).Address
Cr = Chr(34) & Mid(Ca, 2, 1) & Right(Ca, 1) & ":" & Mid(Coa,
2, 1) & Right(Coa, 1) & Chr(34)
MsgBox ActiveWorkbook.Name
MsgBox Chr(34) & Mid(Ca, 2, 1) & Right(Ca, 1) & ":" & Mid(Coa,
2, 1) & Right(Coa, 1) & Chr(34)
MsgBox Range(Cr)
End If
Next cell
Next i
Application.ScreenUpdating = True
End Sub
Thank you for your help,
jfcby