Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Setting Data Validation Programmatically

I have a drop down in my spread sheet and the list is created from a
range on the spread sheet. The formula is : "=BI3:$BL3". When users
import from a previous version of the software some line change the
fomula to something like "=BI27:$BL27" I have been trying to check the
lines and reset their formula1 to the correct range however I keep
getting error 450
"Wrong number of arguments or invalid property assignment"
Does anyone know what I am doing wrong, or is there a better way of
correcting the problem.
I am using vb6.
The line that produces the error:
thisWb.Sheets("Project Sheet").Range(TYPE_COL & r).Validation.Formula1
= "=BI3:$BL3"

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Setting Data Validation Programmatically

Unless there is a specific reason, you need to use absolute references.
Also, if you use relative references, the formula is interpreted relative to
the activecell. This could be causing the formula to be invalid.

Just a guess, but try selecting the cell where you are applying the
formatting prior to applying it.

--
Regards,
Tom Ogilvy


"LoDawg" wrote:

I have a drop down in my spread sheet and the list is created from a
range on the spread sheet. The formula is : "=BI3:$BL3". When users
import from a previous version of the software some line change the
fomula to something like "=BI27:$BL27" I have been trying to check the
lines and reset their formula1 to the correct range however I keep
getting error 450
"Wrong number of arguments or invalid property assignment"
Does anyone know what I am doing wrong, or is there a better way of
correcting the problem.
I am using vb6.
The line that produces the error:
thisWb.Sheets("Project Sheet").Range(TYPE_COL & r).Validation.Formula1
= "=BI3:$BL3"


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Setting Data Validation Programmatically


Tom,
I tried selecting the cell and got a select method failed 1004 error
so I selected the sheet then the cell and the selection worked but I am
now back to the original error. There is a hidden sheet in the work
book with templates for the row types we are adding. The end effect is
a multi tiered framework for project cost estimation. Is there away via
vb6 code to force an absolute reference.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Setting Data Validation Programmatically

Demo'd from the immediate window:

?Activesheet.Cells(5,9).Address(1,1,xlA1,True)
[Book1]Sheet1!$I$5
? Activesheet.Cells(5,9).Address(1,1,xlA1,False)
$I$5


--
Regards,
Tom Ogilvy



"LoDawg" wrote in message
ps.com...

Tom,
I tried selecting the cell and got a select method failed 1004 error
so I selected the sheet then the cell and the selection worked but I am
now back to the original error. There is a hidden sheet in the work
book with templates for the row types we are adding. The end effect is
a multi tiered framework for project cost estimation. Is there away via
vb6 code to force an absolute reference.



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
Data Validation - List - Setting Range from a macro dhstein Excel Discussion (Misc queries) 5 May 14th 09 01:11 PM
Setting up data validation and lookup tables...? Birmangirl Excel Discussion (Misc queries) 3 November 12th 08 12:06 AM
Setting Data Validation Techtrainer Excel Discussion (Misc queries) 2 June 19th 08 08:11 PM
Setting HotKey Programmatically Sprinks Excel Programming 0 December 23rd 05 03:01 PM
Setting up data validation lists Gareth[_3_] Excel Programming 0 September 11th 03 03:25 PM


All times are GMT +1. The time now is 12:24 AM.

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"