Thank you in advance!
I am trying make row(Lrow) and column(Lcol) as variables to be used in Lbound and Ubound that require constant expression.
Sub dynArr()
Dim WSD As Worksheet
Dim Lrow As Long
Dim Lcol As Long
Dim nProd(4 To Lrow) As Long
Dim nMth(5 To Lcol) As Long
ReDim nProd(4 To Lrow)
ReDim nMth(5 To Lcol)
Set WSD = ThisWorkbook.Worksheets("Data")
Lrow = WSD.Cells(Rows.Count, "D").End(xlUp).Row
Lcol = WSD.Cells("E", Columns.Count).End(xlToLeft).Column
For r = LBound(nProd) To UBound(nProd)
For c = LBound(nMth) To UBound(nMth)
If Cells(r, c).Value > 500 Then
Cells(r, c).Interior.Color = RGB(0, 255, 0)
End If
Next c
Next r
End Sub
I am trying make row(Lrow) and column(Lcol) as variables to be used in Lbound and Ubound that require constant expression.
Sub dynArr()
Dim WSD As Worksheet
Dim Lrow As Long
Dim Lcol As Long
Dim nProd(4 To Lrow) As Long
Dim nMth(5 To Lcol) As Long
ReDim nProd(4 To Lrow)
ReDim nMth(5 To Lcol)
Set WSD = ThisWorkbook.Worksheets("Data")
Lrow = WSD.Cells(Rows.Count, "D").End(xlUp).Row
Lcol = WSD.Cells("E", Columns.Count).End(xlToLeft).Column
For r = LBound(nProd) To UBound(nProd)
For c = LBound(nMth) To UBound(nMth)
If Cells(r, c).Value > 500 Then
Cells(r, c).Interior.Color = RGB(0, 255, 0)
End If
Next c
Next r
End Sub