Can rows / columns be resized based on the value of cells?

M

Michael Lanier

I would like columns and rows to adjust according to the values I
enter cells. For example, if A1=12, then I want column C to be
widened to a width of 12. If A2=15, then row 3 should heighten to a
height of 15. Is this possible? Thanks for your help.

Michael
 
P

p45cal

Put your two values in A1 and A2 then run thi
macro:Sub Blah()
Columns("C:C").ColumnWidth = Range("A1").Value
Rows("3:3").RowHeight = Range("A2").Value
End Sub
or put the following in the sheet's cod
module:private Sub Worksheet_Change(ByVal Target A
Range)
If Target.Address = Range("A1").Address Then
Columns("C:C").ColumnWidth = Range("A1").Value
End If
If Target.Address = Range("A2").Address Then
Rows("3:3").RowHeight = Range("A2").Value
End If
End Sub
and watch the column width and row height change as yo
enter different values in the two cells
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top