I want to determine the maximum column and row lenght with a cell value as to loop to the next column when the maximum column/row lenght is reached
I have already the "for" command but couldn't figure out how to code in VBA to check the Sheet of the data set for the max. column and row lenght
Sub Val-Click()
Dim datdate
Dim cell as range
Dim j as long, dim i as long
For i=2 to 3
For j=3 to 8
If Sheet!Z.cells(j,i).Value = "" then
Sheet!Z.cells(j,i).Interior.Color=vRed
End if
Next j
Next i
End Sub
My expected result is that "i" and "j" contains the max. column and row lenght which contains the last cell value. The current problem is that the checking routine loops to the next coulmn based on my predefinition. My aim is however, that the max. "i" and "j" values are determined automaticlly based on a pre exmination which determines the max. column and row lenght in that data matrix that contains the last value the entire rows and columns
you can do this either with a "for" statement or a Do loop or with the "find" function if a particular value is searched for.