VBA Question

P

peyman

hi,
How can I write a code in a way to select the range A to F columns one row
less than active cell row no. . For example if the activecell address is D3
the range will be selected like A2:F2.
Thanks for your help.
 
G

Gary''s Student

Sub ordinate()
n = ActiveCell.Row - 1
Range("A" & n & ":F" & n).Select
End Sub
 
M

Mike H

Hi,

If I've understood correctly then try this

Range("A" & ActiveCell.Row - 1 & ":F" & ActiveCell.Row - 1).Select

Mike
 
P

peyman

yes Mike this works too.Thanks

Mike H said:
Hi,

If I've understood correctly then try this

Range("A" & ActiveCell.Row - 1 & ":F" & ActiveCell.Row - 1).Select

Mike
 
Top