Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default Problem with Populating Data Validation

Hi,

I'm having trouble populating a validation list with my macro, my validation
list is on one sheet, whilst the data to populate the validation list is on
another sheet. The validation list needs to be populated with the values
inside the FilteredProducts Range. My code is as follows:

Set AllClients = Range("CustomerSolutions").Offset(1,
0).Resize(Range("CustomerSolutions").Rows.Count

Set FilteredProducts = AllClients.Columns(8).SpecialCells(xlCellTypeVisib le)
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop,
Operator:= _
xlBetween, Formula1:="=FilteredProducts.Address()"
'Applys a product validation list to the product cell for the particular
customer
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = "Product Required"
.InputMessage = ""
.ErrorMessage = "Please select a product from the drop
down list." & vbCrLf & _
"All rechargeable expenditure as
well as non-rechargeable airfares and accommodation costs must be allocated
to a product."
.ShowInput = True
.ShowError = True
End With

The problem is that the FilteredProducts.Address() is returning an address
such as $H$74, but I need to somehow specify the name of the sheet that the
address is referring to, e.g. SheetName!$H$74 but I'm not too sure how to do
this. I think that might solve the problem but I'm not sure.

Help would be greatly appreciated.
Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 510
Default Problem with Populating Data Validation

Hi

Data Validation list can't refer to another sheet directly - it is possible
only through Named Range. When FilteredProducts is defined as Named Range,
then define your data validation list simply as =FilteredProducts. Whenever
the range FilteredProducts, or values in it, do change, those changes
reflect in your data validation list too.


Arvi Laanemets



"Simon" wrote in message
...
Hi,

I'm having trouble populating a validation list with my macro, my
validation
list is on one sheet, whilst the data to populate the validation list is
on
another sheet. The validation list needs to be populated with the values
inside the FilteredProducts Range. My code is as follows:

Set AllClients = Range("CustomerSolutions").Offset(1,
0).Resize(Range("CustomerSolutions").Rows.Count

Set FilteredProducts =
AllClients.Columns(8).SpecialCells(xlCellTypeVisib le)
With Selection.Validation
.Delete
.Add Type:=xlValidateList,
AlertStyle:=xlValidAlertStop,
Operator:= _
xlBetween, Formula1:="=FilteredProducts.Address()"
'Applys a product validation list to the product cell for the particular
customer
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = "Product Required"
.InputMessage = ""
.ErrorMessage = "Please select a product from the drop
down list." & vbCrLf & _
"All rechargeable expenditure as
well as non-rechargeable airfares and accommodation costs must be
allocated
to a product."
.ShowInput = True
.ShowError = True
End With

The problem is that the FilteredProducts.Address() is returning an address
such as $H$74, but I need to somehow specify the name of the sheet that
the
address is referring to, e.g. SheetName!$H$74 but I'm not too sure how to
do
this. I think that might solve the problem but I'm not sure.

Help would be greatly appreciated.
Thanks.



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
Populating a data validation list based on criteria Ciarán Excel Discussion (Misc queries) 3 February 27th 09 08:03 AM
Populating a Data Validation List Jim Skrydlak Excel Discussion (Misc queries) 2 September 7th 07 12:00 AM
Populating data to other worksheet via data validation kuansheng Excel Programming 2 February 16th 06 08:18 AM
Populating multiple cells on other sheets via data validation kuansheng Excel Programming 0 February 14th 06 06:08 AM
Populating a Validation List with SQL Rone Excel Programming 1 May 15th 04 04:26 AM


All times are GMT +1. The time now is 02:39 PM.

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

About Us

"It's about Microsoft Excel"