how to select every third row

J

Jay

I need to adjust the width of every third row (empty) in a
large range. Thanks in advance

Jay
 
T

Tom Ogilvy

You can adjust Row ** Height ** or Column ** Width ** Below does Height.

Dim rng as Range
Dim i as long
set rng = Range("LargeRange")
for i = rng.rows(1).row to rng.rows(rng.rows.count).row step 3
cells(i,1).EntireRow.Height = 15
Next
 
J

Juan Pablo González

If the other rows (not every third) are not empty, you could use F5, Special
Cells, Blanks. to select the empty cells.
 
J

Jay

Thanks for the response

I meant to say every third column. I figured out a way.

z = 3
For p = 1 To amount
Worksheets("sheet1").Activate
Worksheets("sheet1").Columns(Z).ColumnWidth = 3.59
Z = Z + 3
Next p

Jay
 
R

Robert McCurdy

Hi Jay.
A little easier, where your 'amount' is for 30 columns.

For i = 3 To 30 Step 3
Sheet1.Columns(i).ColumnWidth = 3.59
Next

Where Sheet1 is the sheets code name, Sheets(1) is the sheets position, and Sheets("Sheet1") is the sheets name. You may use
either, but the code name is better because it still identifies the correct sheet if you rename it.


Regards Robert

Thanks for the response

I meant to say every third column. I figured out a way.

z = 3
For p = 1 To amount
Worksheets("sheet1").Activate
Worksheets("sheet1").Columns(Z).ColumnWidth = 3.59
Z = Z + 3
Next p

Jay
 
Top