Set row height in excel vba

Lawrence Salvucci
Lawrence Salvucci used Ask the Experts™
How can I set the row height to a specific value in excel vba? I want all the rows from row 2 down to the last row that has a value in column A set to 15. How can this be written in vba code?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2016

pls try

Sub macro()

For Each c In Range(Range("A1"), Range("A" & Rows.Count).End(xlUp))
    If c <> "" Then
     c.RowHeight = 15
    End If
End Sub

Open in new window

one way to do it is

Sub ChangeRowHeight()

    ActiveSheet.Range(Selection, Selection.End(xlDown)).RowHeight = 25
End Sub

hope this helps.
sorry change 25 to 15 in my post
my code will break if you have empty cells in column A. in that case use the code posted by  Rgonzo1971

just modifying the code a bit

Sub macro()

Range(Range("A1"), Range("A" & Rows.Count).End(xlUp)).RowHeight = 15

End Sub

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial