Posted to microsoft.public.excel.misc
|
|
Copying Formats
So all these groups use 1-5 as the basis for the rowheight:
7-11
12-16
17-21
Option Explicit
Sub testme()
Dim iRow As Long
With Worksheets("sheet1")
For iRow = 7 To .Cells.SpecialCells(xlCellTypeLastCell).Row
.Rows(iRow).RowHeight = .Rows(((iRow - 2) Mod 5) +
1).RowHeight
Next iRow
End With
End Sub
JoeSpareBedroom wrote:
Sorry Dave. Posting when too fatigued. Put blank row at 6. Then, 7-11 match
1-5, and so on.
"Dave Peterson" wrote in message
...
I don't understand what skip row 6 means and yet the rowheights are
duplicated
on 6-11 (6 rows, not 5).
Maybe you could give an example--something like:
1-5 "master" row height
6 skipped
7-11 based on 1-5
12 skipped
13-17 based on 1-5
Or whatever the rules are.
JoeSpareBedroom wrote:
Thanks, Dave. One more question: Let's say I want the macro to look at
the
first 5 rows, duplicated them (which your code apparently does already),
*BUT* I want it to skip a row before doing its thing? In other words,
look
at rows 1 through 5, skip row 6, and duplicate onto rows 6 through 11?
Can
you provide the extra whatever for that?
And, where do I send the virtual beer? :-)
"Dave Peterson" wrote in message
...
Yep. Remember to use a button from the Forms toolbar and to save
before
you try
it--or use a test worksheet.
JoeSpareBedroom wrote:
I know just enough about macros to get in trouble, so I'll try this on
an
experimental sheet first. Attach this to a button, maybe, and click to
my
heart's content?
"Dave Peterson" wrote in message
...
Just the rowheights?
You could use a macro:
Option Explicit
Sub testme()
Dim iRow As Long
With Worksheets("sheet1")
For iRow = 6 To .Cells.SpecialCells(xlCellTypeLastCell).Row
.Rows(iRow).RowHeight = .Rows(((iRow - 1) Mod 5) +
1).RowHeight
Next iRow
End With
End Sub
If you're new to macros, you may want to read David McRitchie's
intro
at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
JoeSpareBedroom wrote:
I know how to use the paste special / format command for things
like
fonts,
alignment, number formats, etc. But, I've got a sheet whose first 5
rows
have had their heights changed in various ways. I need to continue
this
formatting down the page. (Row 1 height =20, Row 2 height = 40, for
instance). In other words, each batch of 5 rows needs to have
heights
like
the first 5 rows.
Any easy way to do this?
--
Dave Peterson
--
Dave Peterson
--
Dave Peterson
--
Dave Peterson
|