Forum Discussion
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 widths. I want to set up a second page with the same layout but different names and data. When I copy the current data over, the height and width of the rows and columns are standard sizes. How do I copy/change row heights or column widths from the already set up page to the next page instead of doing it one at a time?
1 Reply
- NikolinoDEPlatinum 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 SubI 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.