Hey there
Im using the code below to change row heights but it always unhides some adjacent rows.
Would be neat if somebody can tell me how to implement something like SpecialCells so it keeps those hidden cells in peace.
.SpecialCells(xlCellTypeVisible)
Im using the code below to change row heights but it always unhides some adjacent rows.
Would be neat if somebody can tell me how to implement something like SpecialCells so it keeps those hidden cells in peace.
.SpecialCells(xlCellTypeVisible)
VBA Code:
Sub AdjustEmptyRowHeight()
Dim i As Integer
Dim rng As Range
Dim lRow As Long
lRow = ActiveSheet.UsedRange.rows(ActiveSheet.UsedRange.rows.Count).Row
For i = 1 To lRow Step 1
If WorksheetFunction.CountA(rows(i)) = 0 Then
If rng Is Nothing Then
Set rng = rows(i)
Else
Set rng = Union(rng, rows(i))
End If
End If
Next i
If Not rng Is Nothing Then rng.RowHeight = 7
End Sub