choose more than 1 column

  • Thread starter Thread starter Andre Croteau
  • Start date Start date
A

Andre Croteau

Hello,

I am trying to adapt a VBA code seen in these newsgroups, and modify the
following condition to be able to choose more than one column reference:


If Target.Column <> 1 Then Exit Sub


The previous command says if my selection is NOT in Column A, then exit
I would like the command to state if not Column A, N, P and from AA to AM
then exit

I'm not sure of the syntax, I tried a few things, but was incorrect.

Can someone help, please?

Thanks

André
 
If Target.Column = 1 OR _
Target.Column = 14 OR _
Target.Column = 19 OR _
(Target.Column >= 27 AND _
Target.Column <= 39) Then

..... do things

End If


Strictly speaking the () are not needed but use them so
you can read the code more easily.

Chrissy.
 
Sorry about the 9 min delay - I used to send mail every min
but have set it to every 5 mins now so I was a bit slow.

Chrissy.

PS - can you answer my question posted just about yours?

PPS - what are you doing working on a Saturday afternoon?


Andre Croteau wrote
 
ok ok I'm late!

but try this as an (easier/faster) alternative to Chrissy's solution:

Select Case Target.Column
Case 1, 14, 19, 27 To 39
'do stuff or call procedure
End Select


keepITcool

< email : keepitcool chello nl (with @ and .) >
< homepage: http://members.chello.nl/keepitcool >
 
Back
Top