mgp
Mechanical
- May 30, 2001
- 224
Im trying to perform an action depending on the selected cell. Only a number of cells are valid so I want to test if the cell is one of a number of valid cells.
My trial macro goes like this
Public Sub selec()
Row = Application.ActiveCell.Row
col = Application.ActiveCell.Column
testselection = Row & col
If testselection = 44 Or 46 Then
MsgBox ("right selection"
Else
MsgBox ("wrong selection"
End If
End Sub
For some reason the answer is always "right selection" no matter if I select one of the two cells.
Can anyone advice on this or is there another way of testing?
Thanks, Mogens
My trial macro goes like this
Public Sub selec()
Row = Application.ActiveCell.Row
col = Application.ActiveCell.Column
testselection = Row & col
If testselection = 44 Or 46 Then
MsgBox ("right selection"
Else
MsgBox ("wrong selection"
End If
End Sub
For some reason the answer is always "right selection" no matter if I select one of the two cells.
Can anyone advice on this or is there another way of testing?
Thanks, Mogens