I'm really confused as to why I activate a cell:
x = ActiveCell.Row
Yet when I try to select that cell:
Range (Cells(x, 1)).Select
It comes up with an address way out of whack! What am I doing wrong
Visual Basic for Applications (VBA)
I'm really confused as to why I activate a cell:
x = ActiveCell.Row
Yet when I try to select that cell:
Range (Cells(x, 1)).Select
It comes up with an address way out of whack! What am I doing wrong
Hi
Your code should work, I got an error when I ran it on my machine (probably my typo). I changed the syntax slightly and it works fine. The selected cell always goes to the cell in column A of the current row. My routine is below:
Public Sub test()
Dim x As Long
x = ActiveCell.Row
Range("A" & Trim$(Str$(x))).Select
End Sub
Are you sure that your code does not change the value of x before the range select statement
Thanks for your reply. I think I figured out what is wrong, but I'm not sure how to fix it.
The cell I am referring to has a number in it, P027812. The formula seems to be using that cell data as an address (coordinates) rather than just data. So when I try to select the range, it selects column "P" and row 27812.
Any idea how I can fix this
BTW, why do you want to use Cells and Range both at same time You know if you do Cells(3, 2).Select, you select B3. Or you do Range("B3").Select. They are both Range object, thus does the same thing. You only need to use one of them.