macro range

T

tlwhite

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.
 
M

Mike H

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top