Re: Selecting simple range relative to the active cell.

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Dim newRng As Range
If Not ActiveCell.Column = 2 Then
MsgBox "You selected a cell in the wrong column"
Else
rowStr = CStr(ActiveCell.Row)
Set newRng = Range("$B$" & rowStr & ":$J$" & rowStr)
newRng.Select
End If

Steve


"jmac68" <jmac68@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:EFE42576-8D9E-499B-B3F4-FA5589369555@xxxxxxxxxxxxxxxx
I need to have my macro select the 9 cells starting with the active cell in
column B and extending 8 cells to the right. I am doing this as a custom
"copy range" funtion in a macro. I do not want an absolute reference for
the
range. It should be relative to any ACTIVE cell in column B.

If there is no ACTIVE cell in column B, then I would like to return an
error
message "Wrong Column Selected" with and "O.K." button.


.


Quantcast