Solved

Set row height in excel vba

Posted on 2014-02-25
4
3,622 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 52

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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

617 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