Copy and Paste protected row height

dyscjocki

New Member
Joined
Sep 12, 2007
Messages
21
I am attempting to copy and paste a protected sheet so I can make my own modifications. I am able to copy and paste the column width but how do I do the same for row height?
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
You cannot do it manually very easily - there is no "row heights" equivalent of paste special column widths

Try this bit of VBA
- assumes everything is happening within the active workbook
- amend the sheet names and range
- minimising the size of the range reduces the time taken

:eek: VBA needs tailoring if more than one workbook is involved or if pasting to a different range

Place in standard module
Code:
Option Explicit

Sub CopyColWidthAndRowHgt()
    Dim sourceRng As Range, targetRng As Range, r As Long, c As Long
    Set sourceRng = Sheets("[COLOR=#ff0000]FromHere[/COLOR]").Range("[COLOR=#ff0000]A1:Z20[/COLOR]")
    Set targetRng = Sheets("[COLOR=#ff0000]ToHere[/COLOR]").Cells
    
    With sourceRng
        Application.ScreenUpdating = False
        For r = 1 To .Rows.Count
            targetRng.Rows(r).RowHeight = .Rows(r).RowHeight
        Next r
        For c = 1 To .Columns.Count
            targetRng.Columns(c).ColumnWidth = .Columns(c).ColumnWidth
        Next c
        Application.ScreenUpdating = True
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,834
Messages
6,121,874
Members
449,056
Latest member
ruhulaminappu

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