Excel vba rows.height:
Sub outputRowHeight()
Dim i As Integer
For i = 1 To 50
Debug.Print Rows(i).Address & " is : " & Rows(i).Height
Next i
End Sub
columns.width. , , :
Sub outputColumnWidths1()
Dim i As Integer
For i = 1 To 26 '26th letter is Z
Debug.Print Columns(i).Address & " is : " & Columns(i).Width
Next i
End Sub
, , if :
Sub outputColumnWidths2()
Dim i As Integer
For i = 1 To 99 'using 99 as arbitrary high end number
If Columns(i).Address <> "$AA:$AA" Then
Debug.Print Columns(i).Address & " is : " & Columns(i).Width
Else 'once we get outside of A-Z, we want to end.
Exit For
End If
Next i
End Sub
This will produce the same results as in the first example, but you can expand it to the number of columns you want by typing the iteration number and the first column name of the first that you do not want to evaluate.
Hope this helps!
source
share