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
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
Cells
sennekeennes
The same effect with the property explicitly set.
Range (Cells(x, 1).Value).Select
Penicillin
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
Vladimir Chtepa
mschelstrate
x = ActiveCell.Row
Range(Cells(x, 1).Address).Select
Or you could shorten it to this.
ActiveCell.EntireRow.Range("A1").Select
SoniqStylz
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
Labm1ce
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.