ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   macro range (https://www.excelbanter.com/excel-discussion-misc-queries/258924-macro-range.html)

tlwhite

macro range
 
I set my macro up to run on multiple spreadsheets. Unfortunately, the macro
functions are performed for the number of lines in the original spreadsheet.
The macro was recorded using 'ctrl + end' rather than a specific row and
column.

Is there a way to have the macro only apply through 'ctrl + end' ?
Thanks.

Mike H

macro range
 
Hi,

There are several ways of find the last row, last column but you didn't tell
us what you are trying to find.

Here's 2 ways

Last used column in row 1
lastcol = Cells(1, Columns.Count).End(xlToLeft).Column

last used row in a column
lastrow = Cells(Cells.Rows.Count, "A").End(xlUp).Row
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"tlwhite" wrote:

I set my macro up to run on multiple spreadsheets. Unfortunately, the macro
functions are performed for the number of lines in the original spreadsheet.
The macro was recorded using 'ctrl + end' rather than a specific row and
column.

Is there a way to have the macro only apply through 'ctrl + end' ?
Thanks.



All times are GMT +1. The time now is 05:19 PM.

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