ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selecting cells (https://www.excelbanter.com/excel-programming/285291-selecting-cells.html)

PaulSinki[_3_]

Selecting cells
 
I've got a question that is really simple, but I just can't figure out
how to get the syntax right.
I want the macro to pick a certain column, which is identified from
user input, and then select a range below that to run a loop through.
This is the current code:

Range("o7:r7").Find(What:=MyValue3).Activate
Range("d9:d360").Select

(MyValue3 is defined by the user and is a week number found in the
range O7 to R7).
What I want to replace is the Range d9:d360 with a reference that will
select from rows 9 to 360 no matter what column it's in.
I tried Range("[RC]:[RC360]") to no avail.
What am I doing wrong, and what will make this work?
Thanks,
a very frustrated beginner....


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


[email protected]

Selecting cells
 
Is this what you're trying to do?

Dim intC As Integer

Range("o7:r7").Find(What:=MyValue3).Activate
intC = ActiveCell.Column
Range(Cells(9, intC), Cells(360, intC)).Select


HTH
Paul
--------------------------------------------------------------------------------------------------------------
Be advised to back up your WorkBook before attempting to make changes.
--------------------------------------------------------------------------------------------------------------

I've got a question that is really simple, but I just can't figure out
how to get the syntax right.
I want the macro to pick a certain column, which is identified from
user input, and then select a range below that to run a loop through.
This is the current code:

Range("o7:r7").Find(What:=MyValue3).Activate
Range("d9:d360").Select

(MyValue3 is defined by the user and is a week number found in the
range O7 to R7).
What I want to replace is the Range d9:d360 with a reference that will
select from rows 9 to 360 no matter what column it's in.
I tried Range("[RC]:[RC360]") to no avail.
What am I doing wrong, and what will make this work?
Thanks,
a very frustrated beginner....


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




All times are GMT +1. The time now is 10:01 PM.

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