ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   vba, identifying a range (https://www.excelbanter.com/excel-worksheet-functions/38316-vba-identifying-range.html)

Danny

vba, identifying a range
 
I write a macro to find a named range, say A15. Then I go up one row and
select several columns. My macro would read Range("A14:D14").Select

When I add more columns and sort, then do the same command (finding the
named range), the named range would be anywhere (no longer A15) so when I go
up one cell and select several columns the cells WOULD not be
Range("A14:D14").select

How do I identify the Range(s) in my macro?

Thanks.

Trevor Shuttleworth

Range("A15").Offset(-1, 0).Resize(, 4).Select

Regards

Trevor


"Danny" wrote in message
...
I write a macro to find a named range, say A15. Then I go up one row and
select several columns. My macro would read Range("A14:D14").Select

When I add more columns and sort, then do the same command (finding the
named range), the named range would be anywhere (no longer A15) so when I
go
up one cell and select several columns the cells WOULD not be
Range("A14:D14").select

How do I identify the Range(s) in my macro?

Thanks.





All times are GMT +1. The time now is 03:31 AM.

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