Forum Discussion
Kattie
Jun 23, 2021Copper Contributor
Copy Row Heights or Column Width
Hi I am working on Windows 10 with Excel 365. I have searched a lot on the internet and help areas but I can't seem to find an answer to this: I have set up a page with row heights and column...
NikolinoDE
Jun 23, 2021Platinum Contributor
Here is a VBA solution, just hope it's not Office for web.
Enter the code below into a standard module and assign it to a button.
Sub SuperCopy ()
Dim rngSource As Range, rngTarget As Range
Dim iCounter As Integer
Set rngSource = Worksheets ("Sheet1"). Range ("A1: C5")
Set rngTarget = Worksheets ("Sheet2"). Range ("A1: C5")
rngSource.Copy rngTarget
For iCounter = 1 To rngSource.Rows.Count
rngTarget.Rows (iCounter) .RowHeight = _
rngSource.Rows (iCounter) .RowHeight
Next iCounter
For iCounter = 1 To rngSource.Columns.Count
rngTarget.Columns (iCounter) .ColumnWidth = _
rngSource.Columns (iCounter) .ColumnWidth
Next iCounter
End Sub
I would be happy to know if I could help.
Nikolino
I know I don't know anything (Socrates)
* Kindly Mark and Vote this reply if it helps please, as it will be beneficial to more Community members reading here.