Row heights with copy command

kckay

Board Regular
Joined
Nov 8, 2010
Messages
134
I am copying a block of rows to another area of my worksheet.

The code does not carry the Source_Range as formatted (row heights) and re-format the Dest_Range. This leaves the Dest_Range row heights as the rows are defined in the workbook rather than how the Source_Range is formatted for row_height.

How can I carry the row heights as defined in Source_Range to Dest_Range?

Code:
.
.
For n = 2 To Number_Of_Rows
 
Set Dest_Range = Sheets("Sources").Range(Row_start, Row_end)
 
Source_Range.Copy Dest_Range
.
.
.
Next n
[\code]
 
Last edited:

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Maybe inserting this code-line

Code:
Dest_Range.RowHeight = Source_Range.RowHeight


M.
 
Upvote 0
I don't know way to do it all at once.
You could loop through your original row heights.
Something like. . .
Code:
For r = 1 to 10
Cells(10 + r, 1).RowHeight = Cells(r, 1).RowHeight
Next i
I didn't know the locations so I just took the row height from Range("A1:A10") and applied them to Range("A11:A20")
 
Upvote 0
Which way worked?
I was curious about Marcelo Branco's method. I sounded good.
 
Upvote 0
Which way worked?
I was curious about Marcelo Branco's method. I sounded good.

Not tested but i think that my method works only if all the rows in Source_range have the same height.

With differents heights your method is the correct (i think...).

M.
 
Upvote 0
That was the part I was interested in. If it could handle multiple heights. Thanks for the answer.
 
Upvote 0
Tested with different heights and my method worked fine

Edit

Doesnt work with different heights!!!


M.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,552
Messages
6,179,486
Members
452,917
Latest member
MrsMSalt

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top