Copy Row Heights

A

Arun

I would like to copy the row heights from one worksheet to another, but none
of the other formatting (I realize I can copy-paste special an entire row and
get the row height to change, but I can't have the rest of the formatting
copy with it). Is there any reason that the paste-special dialog box has a
'column width' selection but not a selection for 'row height'???
 
G

Gord Dibben

Select the rows to copy and paste to sheet2.

Edit>Clear>All

Data and formatting is gone but row heights remain.

Why there is no "row height" in paste special is not known by anyone but the
developers.


Gord Dibben MS Excel MVP
 
A

Arun

I am actually pasting not to a blank sheet, but a sheet with it's own data
and formatting that I want to keep. The section I want to adjust the row
heights on is identical to that of the first sheet except for a number of
conditional formats and cell colors that I want to retain.
 
D

Dave Peterson

Is a macro ok?

If yes:

Option Explicit
Sub testme()

Dim iRow As Long
Dim FromWks As Worksheet
Dim ToWks As Worksheet

Set FromWks = Worksheets("Sheet1")
Set ToWks = Worksheets("Sheet2")

For iRow = 3 To 19
ToWks.Rows(iRow).RowHeight = FromWks.Rows(iRow).RowHeight
Next iRow

End Sub

I assumed that the row numbers of each range match up on both sheets.

If you're new to macros:

Debra Dalgleish has some notes how to implement macros here:
http://www.contextures.com/xlvba01.html

David McRitchie has an intro to macros:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Ron de Bruin's intro to macros:
http://www.rondebruin.nl/code.htm

(General, Regular and Standard modules all describe the same thing.)
 
D

Dave Peterson

And I also assumed you wanted to use rows 3:19.

Dave said:
Is a macro ok?

If yes:

Option Explicit
Sub testme()

Dim iRow As Long
Dim FromWks As Worksheet
Dim ToWks As Worksheet

Set FromWks = Worksheets("Sheet1")
Set ToWks = Worksheets("Sheet2")

For iRow = 3 To 19
ToWks.Rows(iRow).RowHeight = FromWks.Rows(iRow).RowHeight
Next iRow

End Sub

I assumed that the row numbers of each range match up on both sheets.

If you're new to macros:

Debra Dalgleish has some notes how to implement macros here:
http://www.contextures.com/xlvba01.html

David McRitchie has an intro to macros:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Ron de Bruin's intro to macros:
http://www.rondebruin.nl/code.htm

(General, Regular and Standard modules all describe the same thing.)
 

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