ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   RESIZE USEDRANGE (https://www.excelbanter.com/excel-programming/350077-resize-usedrange.html)

AK

RESIZE USEDRANGE
 
Please help.

I want to select the used range with the first 1 row not to select.
If I use the Offset to select :-
Selection.Offset(1,0).Select
The range will be down 1 row and an empty row after the last used row will
also be selected
If I use the resize:-
Selection.Resize(numRows -1, numColumns).Select
The last used row will be deselected.

What exactly should I write ?

Thanks in advance


Executor

RESIZE USEDRANGE
 
Hi ak,

You are close:

Dim numRows As Integer
Dim numColumns As Integer
numRows = Selection.Rows.Count
numColumns = Selection.Columns.Count
Selection.Offset(1, 0).Resize(numRows - 1, numColumns).Select

HTH

Executor


AK

RESIZE USEDRANGE
 
Hi Executor,

It works.

Thanks again.

"Executor" 來函:

Hi ak,

You are close:

Dim numRows As Integer
Dim numColumns As Integer
numRows = Selection.Rows.Count
numColumns = Selection.Columns.Count
Selection.Offset(1, 0).Resize(numRows - 1, numColumns).Select

HTH

Executor




All times are GMT +1. The time now is 09:24 PM.

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