SoftMaker.com

English-Language Support
It is currently Tue Jun 18, 2013 9:00 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Thu May 19, 2011 1:03 am 
Offline

Joined: Thu May 19, 2011 12:49 am
Posts: 2
Location: Manitoba, Canada
Hi,

I want to add Validation to a worksheet column from a script. I have created a list of valid entries in cells V1 to V31 in the active worksheet. I get a compile/syntax error on the following statement:

pm.ActiveSheet.Columns(5).Validation.Add pmValidateList,,,V1:V31,

According to the Help file for the Validation object, the only required field for the 'pmValidateList' validation type is a "list of values, separated by the system list separator, or a cell reference" in the 'Formula1' parameter. Can you tell me what I am doing wrong and give me an example of the correct 'Validation.Add' syntax?

Thanks!


Top
 Profile  
 
PostPosted: Thu May 19, 2011 10:35 am 
Offline
SoftMaker Team
SoftMaker Team

Joined: Wed Apr 09, 2008 7:26 am
Posts: 4578
Location: Nuremberg
#1: It seems that the interpreter does not accept empty arguments, only missing arguments at the end

#2: V1:V31 must be passed as string (BasicMaker doesn't know application specific addressing modes)

#3: Due to some internal restrictions, the region must be selected before

Correct line looks like

pm.ActiveSheet.Columns(5).Select
pm.ActiveSheet.Selection.Validation.Add pmValidateList,0,0,"V1:V31"

_________________
Sven Leßmann
SoftMaker Software GmbH


Top
 Profile  
 
PostPosted: Sat May 21, 2011 4:26 am 
Offline

Joined: Thu May 19, 2011 12:49 am
Posts: 2
Location: Manitoba, Canada
Thanks for your prompt reply.

I am using the following code:

pm.ActiveSheet.Columns(5).Select
pm.ActiveSheet.Selection.Validation.Add pmValidateList,0,0,"V1:V31"
pm.ActiveSheet.Selection.Validation.InCellDropDown = True

The second line does add validation to the column, but it interprets "V1:V31" as a single allowable value, not a cell range containing a list of allowable values. When I open the PlanMaker worksheet after running the script and click on one of the cells in the selected column, the drop-down list box shows only one allowable value, 'V1:31'. How can I designate 'V1:V31' as a cell range, not an allowable value?

Thanks!


Top
 Profile  
 
PostPosted: Mon May 23, 2011 8:40 am 
Offline
SoftMaker Team
SoftMaker Team

Joined: Wed Apr 09, 2008 7:26 am
Posts: 4578
Location: Nuremberg
Use "=V1:V36". Note: V1:V36 is a relative range, maybe you want to use "=$V$1:$V$36" to always refer to V1:V36.

_________________
Sven Leßmann
SoftMaker Software GmbH


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group