Hi everyone
I’m trying to get an in cell data validation dropdown to work and I’m having no luck. Any help is appreciated.
Here’s what I’ve got…
I have two workbooks in the same folder
1. Reference Worksheets
2. Profile worksheets
The Reference workbook contains (as of now, this may change) one sheet named “Reference sheet”. This sheet consists of single column dynamic named ranges (all columns contain headings) that I’m trying to use to populate in cell drop down lists for worksheet forms I’ve designed in the “Profile worksheets” workbook.
This is the formula I’m using to define my dynamic named ranges. This example is for the list in column C.
This is the code that I’m using to create and populate the in cell drop down list in the “Profile Worksheets” workbook.
Prefix = named range in column C
Note: Reference Worksheets is meant to be closed when this code will be executed.
When I run it, I get the following error:
Runtime error 1004 – Application defined or object defined error
I think it has to do with the formula1 reference, but I’m not sure how to fix it.
I’m trying to get an in cell data validation dropdown to work and I’m having no luck. Any help is appreciated.
Here’s what I’ve got…
I have two workbooks in the same folder
1. Reference Worksheets
2. Profile worksheets
The Reference workbook contains (as of now, this may change) one sheet named “Reference sheet”. This sheet consists of single column dynamic named ranges (all columns contain headings) that I’m trying to use to populate in cell drop down lists for worksheet forms I’ve designed in the “Profile worksheets” workbook.
This is the formula I’m using to define my dynamic named ranges. This example is for the list in column C.
Code:
=OFFSET('Reference Sheet'!$C$1,1,0,COUNTA('Reference Sheet'!$C:$C)-1,1)
This is the code that I’m using to create and populate the in cell drop down list in the “Profile Worksheets” workbook.
Code:
Sub populatePrefixList()
With Range("B12").Validation
.Add Type:=xlValidateList, _
AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, _
Formula1:="=[Reference Worksheets]!Prefix"
.InCellDropdown = True
End With
End Sub
Prefix = named range in column C
Note: Reference Worksheets is meant to be closed when this code will be executed.
When I run it, I get the following error:
Runtime error 1004 – Application defined or object defined error
I think it has to do with the formula1 reference, but I’m not sure how to fix it.