ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel VBA - Varible number rows (https://www.excelbanter.com/excel-programming/299898-excel-vba-varible-number-rows.html)

louismx

Excel VBA - Varible number rows
 
Hello

I am using Ctl F to find end ( marked by = ) of a block of rows in
spread sheet. I then use CTL HOME to select from the end to beginning.

I want to use this command as a macro.
The blocks have a variable number of rows ranging 6 to 20 rows.
However when I run as macro it fails when the number of rows in th
block changes.

Any ideas to solve would be appreciated.

Loui

--
Message posted from http://www.ExcelForum.com


Frank Kabel

Excel VBA - Varible number rows
 
Hi
you may post your existing macro and describe what you're trying to
achieve. In most cases there's no need for selecting a range

--
Regards
Frank Kabel
Frankfurt, Germany


Hello

I am using Ctl F to find end ( marked by = ) of a block of rows in a
spread sheet. I then use CTL HOME to select from the end to

beginning.

I want to use this command as a macro.
The blocks have a variable number of rows ranging 6 to 20 rows.
However when I run as macro it fails when the number of rows in the
block changes.

Any ideas to solve would be appreciated.

Louis


---
Message posted from http://www.ExcelForum.com/



Tom Ogilvy

Excel VBA - Varible number rows
 
Ctrl+Home goes to A1 for me

Dim rng as Range
set rng = Range(Range("A1"),Cells.find("="))

rng.Select

Another possibility

Dim rng as Range
set rng = cells.find("=")
rng.CurrentRegion.Select

--
Regards,
Tom Ogilvy


"louismx " wrote in message
...
Hello

I am using Ctl F to find end ( marked by = ) of a block of rows in a
spread sheet. I then use CTL HOME to select from the end to beginning.

I want to use this command as a macro.
The blocks have a variable number of rows ranging 6 to 20 rows.
However when I run as macro it fails when the number of rows in the
block changes.

Any ideas to solve would be appreciated.

Louis


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 12:26 PM.

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