PC Review


Reply
Thread Tools Rate Thread

Adjust row heights of non-contiguous rows.

 
 
BEEJAY
Guest
Posts: n/a
 
      15th Dec 2009
Hello all:

Looking to adjust row heights of a 185 row w/sheet.
First I use: Rows("4:184").RowHeight = 12.75
I expect this should work quickly and efficiently.

I don't quite know what to do with the "exceptions" rows.
I could use: Rows("6:6, 9:9, 14:14, 18:18, 24:24, 30:30,
ETC......").RowHeight = 3.75
But there are over 30 rows that need to be referenced. The double row
references become cumbersome and don't really add to the clarify of the code.

I'd like to use something like:
SRow = Short Rows
Short Rows = (6, 9, 14, 18, 24, 30, etc........)

Then: SRow.Row Height = 3.75.
If something like this can be done, I think it would be "easier" to read and
also to adjust, if and as required.

Thanks

 
Reply With Quote
 
 
 
 
Ryan H
Guest
Posts: n/a
 
      15th Dec 2009
Is it always the same rows that are 3.75 or 12.75 in height or does it vary?
If it varies, what determines if it is a Short Row or not? Kinda need that
inorder to help you out.

--
Cheers,
Ryan


"BEEJAY" wrote:

> Hello all:
>
> Looking to adjust row heights of a 185 row w/sheet.
> First I use: Rows("4:184").RowHeight = 12.75
> I expect this should work quickly and efficiently.
>
> I don't quite know what to do with the "exceptions" rows.
> I could use: Rows("6:6, 9:9, 14:14, 18:18, 24:24, 30:30,
> ETC......").RowHeight = 3.75
> But there are over 30 rows that need to be referenced. The double row
> references become cumbersome and don't really add to the clarify of the code.
>
> I'd like to use something like:
> SRow = Short Rows
> Short Rows = (6, 9, 14, 18, 24, 30, etc........)
>
> Then: SRow.Row Height = 3.75.
> If something like this can be done, I think it would be "easier" to read and
> also to adjust, if and as required.
>
> Thanks
>

 
Reply With Quote
 
Jacob Skaria
Guest
Posts: n/a
 
      15th Dec 2009
Try the below

Dim rngTemp As Range
Set rngTemp = Range("A6,A9,A14,A18,A24,A30")
rngTemp.RowHeight = 8

--
Jacob


"BEEJAY" wrote:

> Hello all:
>
> Looking to adjust row heights of a 185 row w/sheet.
> First I use: Rows("4:184").RowHeight = 12.75
> I expect this should work quickly and efficiently.
>
> I don't quite know what to do with the "exceptions" rows.
> I could use: Rows("6:6, 9:9, 14:14, 18:18, 24:24, 30:30,
> ETC......").RowHeight = 3.75
> But there are over 30 rows that need to be referenced. The double row
> references become cumbersome and don't really add to the clarify of the code.
>
> I'd like to use something like:
> SRow = Short Rows
> Short Rows = (6, 9, 14, 18, 24, 30, etc........)
>
> Then: SRow.Row Height = 3.75.
> If something like this can be done, I think it would be "easier" to read and
> also to adjust, if and as required.
>
> Thanks
>

 
Reply With Quote
 
Rick Rothstein
Guest
Posts: n/a
 
      15th Dec 2009
You could do what you want this way...

Sub AdjustRowHeights()
Dim V As Variant, ShortRows As Variant
ShortRows = Array(6, 9, 14, 18, 24, 30)
Rows("4:184").RowHeight = 12.75
For Each V In ShortRows
Rows(V).RowHeight = 3.75
Next
End Sub

Just put your list of rows in the Array function call.

--
Rick (MVP - Excel)


"BEEJAY" <(E-Mail Removed)> wrote in message
news:5C510F75-B33D-4B9C-8617-(E-Mail Removed)...
> Hello all:
>
> Looking to adjust row heights of a 185 row w/sheet.
> First I use: Rows("4:184").RowHeight = 12.75
> I expect this should work quickly and efficiently.
>
> I don't quite know what to do with the "exceptions" rows.
> I could use: Rows("6:6, 9:9, 14:14, 18:18, 24:24, 30:30,
> ETC......").RowHeight = 3.75
> But there are over 30 rows that need to be referenced. The double row
> references become cumbersome and don't really add to the clarify of the
> code.
>
> I'd like to use something like:
> SRow = Short Rows
> Short Rows = (6, 9, 14, 18, 24, 30, etc........)
>
> Then: SRow.Row Height = 3.75.
> If something like this can be done, I think it would be "easier" to read
> and
> also to adjust, if and as required.
>
> Thanks
>


 
Reply With Quote
 
BEEJAY
Guest
Posts: n/a
 
      15th Dec 2009
Thanks all for the prompt response.
Timing could not have been better.

Rick, I used your code (with good success).
I will yet try out Jacobs code, as well.


"Rick Rothstein" wrote:

> You could do what you want this way...
>
> Sub AdjustRowHeights()
> Dim V As Variant, ShortRows As Variant
> ShortRows = Array(6, 9, 14, 18, 24, 30)
> Rows("4:184").RowHeight = 12.75
> For Each V In ShortRows
> Rows(V).RowHeight = 3.75
> Next
> End Sub
>
> Just put your list of rows in the Array function call.
>
> --
> Rick (MVP - Excel)
>
>
> "BEEJAY" <(E-Mail Removed)> wrote in message
> news:5C510F75-B33D-4B9C-8617-(E-Mail Removed)...
> > Hello all:
> >
> > Looking to adjust row heights of a 185 row w/sheet.
> > First I use: Rows("4:184").RowHeight = 12.75
> > I expect this should work quickly and efficiently.
> >
> > I don't quite know what to do with the "exceptions" rows.
> > I could use: Rows("6:6, 9:9, 14:14, 18:18, 24:24, 30:30,
> > ETC......").RowHeight = 3.75
> > But there are over 30 rows that need to be referenced. The double row
> > references become cumbersome and don't really add to the clarify of the
> > code.
> >
> > I'd like to use something like:
> > SRow = Short Rows
> > Short Rows = (6, 9, 14, 18, 24, 30, etc........)
> >
> > Then: SRow.Row Height = 3.75.
> > If something like this can be done, I think it would be "easier" to read
> > and
> > also to adjust, if and as required.
> >
> > Thanks
> >

>
> .
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Turn off auto adjust of row heights julesofmooney Microsoft Excel Worksheet Functions 0 6th Dec 2009 06:20 AM
Creating a Macro to adjust the row heights JeffK Microsoft Excel Programming 7 11th Nov 2009 08:39 PM
Adjusting DataGridView row heights on existing rows michael sorens Microsoft C# .NET 5 16th Jun 2008 02:28 AM
How do I maintain different row heights when I copy rows down a p. =?Utf-8?B?ZGFubGlua3NtYW4=?= Microsoft Excel Worksheet Functions 0 24th Jan 2005 07:53 PM
203 rows heights have been chaged to zero Woods Microsoft Excel Misc 3 22nd Sep 2004 06:29 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:30 AM.