how to select every third row

  • Thread starter Thread starter Jay
  • Start date Start date
J

Jay

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

Jay
 
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
 
If the other rows (not every third) are not empty, you could use F5, Special
Cells, Blanks. to select the empty cells.
 
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
 
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
 

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

Back
Top