Increase row heights base upon number in another cell

jono7gold

New Member
Joined
Sep 26, 2013
Messages
28
Hi, hope someone can help??

I want to change the row height base upon a number value in another cell, I would like this to apply across 5 rows.
So if A1 = 5 then row G will be a height of 5, if no cell value is entered in A1 then the height would be 0. Can this also be applied to B1 changing row H, C1 to row I, D1 to row J & E1 to row K.

Thank you.

Jon
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
So if A1 = 5 then row G will be a height of 5
G is a column, not a row. For columns you can change the width of the cells, not the height (unless changing height for the whole worksheet)
Can you please clarify your requirement?
 
Last edited:
Upvote 0
Sorry I have completely misled you here. It is the row height I want to change. So if A1=5 then row 10 would be at a height of 5, A2 would change row 11 height, A3 change row 12, A4 change row 13 and A5 would change row 14.

Thanks again.
 
Upvote 0
Thanks for the clarification. try this worksheet change event code. To implement ..
1. Right click the sheet name tab and choose "View Code".
2. Copy and Paste the code below into the main right hand pane that opens at step 1.
3. Close the Visual Basic window & test by entering/altering/deleting values in A1:A5

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
  Dim Changed As Range, c As Range
  
  Set Changed = Intersect(Target, Range("A1:A5"))
  If Not Changed Is Nothing Then
    For Each c In Changed
      If Len(c.Value) > 0 Then
        If IsNumeric(c.Value) Then
          On Error Resume Next
          Rows(c.Row + 9).RowHeight = c.Value
          On Error GoTo 0
        End If
      End If
    Next c
  End If
End Sub
 
Upvote 0
You're welcome. Thanks for the follow-up. :)
 
Upvote 0
Hi again,

I do have one query, when it reads the cells A1:A5 if there is a number value typed in the macro works fine. If the cell have a number determined by a formula in that cell then the macro doesnt work. Can this be done so it reads the value even if its a formula? e.g A1=B2+B3
 
Upvote 0
They are just simple formulas like below:

A1 is '=A1=C1*2'
A2 is '=A1'

A3 to A5 have formulas similar to above.
 
Upvote 0

Forum statistics

Threads
1,214,919
Messages
6,122,260
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top