ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Row Hieght/Coulmn Width (https://www.excelbanter.com/excel-programming/435731-row-hieght-coulmn-width.html)

Dorian C. Chalom

Row Hieght/Coulmn Width
 
How can I copy the Row Hieght and Column Width from one sheet to another
within the same workbook?



Nigel[_3_]

Row Hieght/Coulmn Width
 
In general

Sheets(2).Rows(1).RowHeight = Sheets(1).Rows(1).RowHeight
Sheets(2).Columns(1).ColumnWidth = Sheets(1).Columns(1).ColumnWidth

Or assign the source sheet height and width to variables and use that

e.g for height.....

Dim iH As Double
iH = Sheets(1).Rows(1).RowHeight

Sheets(2).Rows(1).RowHeight = iH

you can also assign this to more than one row (or column).

Sheets(2).Rows("1:10").RowHeight = iH



--

Regards,
Nigel




"Dorian C. Chalom" wrote in message
...
How can I copy the Row Hieght and Column Width from one sheet to another
within the same workbook?



Dorian C. Chalom

Row Hieght/Coulmn Width
 
OK I was thinking like your first example...
But lets say I want to loop through all the rows and columns.
How do I determine the last row and column used?
Can I do that?

"Nigel" wrote in message
...
In general

Sheets(2).Rows(1).RowHeight = Sheets(1).Rows(1).RowHeight
Sheets(2).Columns(1).ColumnWidth = Sheets(1).Columns(1).ColumnWidth

Or assign the source sheet height and width to variables and use that

e.g for height.....

Dim iH As Double
iH = Sheets(1).Rows(1).RowHeight

Sheets(2).Rows(1).RowHeight = iH

you can also assign this to more than one row (or column).

Sheets(2).Rows("1:10").RowHeight = iH



--

Regards,
Nigel




"Dorian C. Chalom" wrote in message
...
How can I copy the Row Hieght and Column Width from one sheet to another
within the same workbook?





Rick Rothstein

Row Hieght/Coulmn Width
 
Depending on what you want...

For last displayed value
==========================
LastUsedRow = ActiveSheet.Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row

LastUsedCol = ActiveSheet.Cells.Find(What:="*", SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Column

For last value or formula
===============================
LastUsedRow = ActiveSheet.Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlFormulas).Row

LastUsedCol = ActiveSheet.Cells.Find(What:="*", SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious, LookIn:=xlFormulas).Column

That "last value or formula" one will find the last cell with an actual
value or with a formula in it even if the formula evaluates to the empty
string ("").

--
Rick (MVP - Excel)


"Dorian C. Chalom" wrote in message
...
OK I was thinking like your first example...
But lets say I want to loop through all the rows and columns.
How do I determine the last row and column used?
Can I do that?

"Nigel" wrote in message
...
In general

Sheets(2).Rows(1).RowHeight = Sheets(1).Rows(1).RowHeight
Sheets(2).Columns(1).ColumnWidth = Sheets(1).Columns(1).ColumnWidth

Or assign the source sheet height and width to variables and use that

e.g for height.....

Dim iH As Double
iH = Sheets(1).Rows(1).RowHeight

Sheets(2).Rows(1).RowHeight = iH

you can also assign this to more than one row (or column).

Sheets(2).Rows("1:10").RowHeight = iH



--

Regards,
Nigel




"Dorian C. Chalom" wrote in message
...
How can I copy the Row Hieght and Column Width from one sheet to another
within the same workbook?







All times are GMT +1. The time now is 08:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com