Solved

Set row height in excel vba

Posted on 2014-02-25
4
3,157 Views
Last Modified: 2014-02-25
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?
0
Comment
Question by:Lawrence Salvucci
  • 3
4 Comments
 
LVL 50

Accepted Solution

by:
Rgonzo1971 earned 250 total points
ID: 39885644
Hi,

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
Next
End Sub

Open in new window

Regards
0
 
LVL 22

Expert Comment

by:spattewar
ID: 39885651
one way to do it is

Sub ChangeRowHeight()

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

hope this helps.
0
 
LVL 22

Expert Comment

by:spattewar
ID: 39885652
sorry change 25 to 15 in my post
0
 
LVL 22

Assisted Solution

by:spattewar
spattewar earned 250 total points
ID: 39885656
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
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question