Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default choose more than 1 column

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é


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 101
Default choose more than 1 column

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.

"Andre Croteau" wrote in message ...
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é




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default choose more than 1 column

Elapsed time 9 minutes!!! I'm impressed
Thank you very much

"Chrissy" wrote in message
...
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.

"Andre Croteau" wrote in message

...
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é






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 101
Default choose more than 1 column

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
Elapsed time 9 minutes!!! I'm impressed
Thank you very much

"Chrissy" wrote in message
...
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.

"Andre Croteau" wrote in message

...
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é








  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default choose more than 1 column

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


"Chrissy" wrote:

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
Elapsed time 9 minutes!!! I'm impressed
Thank you very much

"Chrissy" wrote in message
...
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.

"Andre Croteau" wrote in message

...
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é












Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
choose last cell with a value in a column jcheko Excel Discussion (Misc queries) 6 December 8th 09 02:50 PM
CHOOSE from a column FARAZ QURESHI Excel Discussion (Misc queries) 6 February 2nd 09 02:14 PM
Choose Column in Calculation martins New Users to Excel 2 April 3rd 06 06:14 PM
how i choose the column from a combo box Alberto Vargas Excel Discussion (Misc queries) 4 July 22nd 05 11:07 PM
in excel, how do I choose a column and add 20% servmarkpdx Excel Worksheet Functions 1 November 18th 04 07:36 PM


All times are GMT +1. The time now is 05:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"