
Originally Posted by
SamT
Range(add1, add2).autofill Works
Range(add1,col1 & Range(col1 & Rows.Count) Means
Range("B2", "21") "1" is the Row that Range("21,048,576").End(xlUP).Row
will return. Unless you accidentally put some value in the column
Cells("21,048,576") happens to fall in.
IOW, "
Range(add1,col1 & Range(col1 & Rows.Count).End(xlUp).Row)" is GIGO And I don't know what exactly you are trying to do.
Run this Code
Range("A1").Select
MsgBox "Message #1: The Active Cell is " & ActiveCell.Address
col0 = ActiveCell.Column
ActiveCell.Offset(0, 1).Select
MsgBox "Message #2: The Active Cell is " & ActiveCell.Address
add1 = ActiveCell.address
col1 = ActiveCell.Column
ActiveCell.Value = 1
ActiveCell.Offset(1, 0).Select
MsgBox "Message #3: The Active Cell is " & ActiveCell.Address
add2 = ActiveCell.address
ActiveCell.Value = 2
MsgBox "Message #4: The wierd address is " & Range(add1,col1 & Range(col1 & Rows.Count).End(xlUp).Row).Address
Hey SamT,
I am trying to make an autofill function depending on the values on the left column. If the value in the left column is empty, the script stops. The autofill is a series from 1 to x, where x is the last row of a filled cell in the left column. The autofill should work regardless the first cell's position, ie. the first reference cell position is not hardcoded.
I should have removed "Range("A1").Select from the code. I just noticed that error but code still doesn't work.
The last line is giving me an error "Method 'Range' of object '_Global' failed.
After re-reading your explanation, it means I cannot use Activecell.Column to define the column address.
How do I make this flexible?
Originally:
Range("A1:B" & Range("A" & Rows.Count).End(xlUp).Row)