Cell Validation to External Worksheet

wrightr

New Member
Joined
Sep 13, 2006
Messages
16
In Book 1 I have a number of cells that require validation and instead of keeping them in the same workbook I want to create a seperate Workbook (Book 2) that allows me to create the cell validation by named ranges.

The named ranges would then be updated everytime Book 1 was opened

How do I link the two sheets together? As I can't seem to do it using the usual Data\Validation link
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Thats great thanks.

How do I get the workbook to always be open - do I have to add code to get this done?
 
Upvote 0
You could put some code to open it in the Workbook_Open event procedure of the workbook containing the data validation.
 
Upvote 0
Thanks Andrew

Don't suppose there is a standard bit of code for this I could use?

Thanks

Rick
 
Upvote 0
Not exactly standard, but this worked for me:

Code:
Private Sub Workbook_Open()
    Dim Source As String
    Dim Pos As Integer
    Dim SourceName As String
    Source = ThisWorkbook.Names("MyList").RefersTo
    If InStr(1, Source, ":") > 0 Then
        Pos = InStr(1, Source, "!")
        SourceName = WorksheetFunction.Substitute(Left(Source, Pos - 1), "'", "")
        Workbooks.Open Right(SourceName, Len(SourceName) - 1)
        ThisWorkbook.Activate
    End If
End Sub

The code assumes you used the name MyList in your Data Validation. Change to suit.
 
Upvote 0
Andrew

Thanks for your help on this but can't get it to work.

Is there code I could put in the template that requires the validation (not the one holding the validation) that automatically opens the validation file and then closes it when the workbook is closed?

Thanks again for the help

Rick
 
Upvote 0
In what way didn't it work? The code I posted goes in the ThisWorkbook module of the workbook that contains the data validation.
 
Upvote 0
Andrew

Apologies, added the text to the wrong section.

I take it that I can now hide this file and then get the file to close on shutdown?

Many thanks

Rick
 
Upvote 0

Forum statistics

Threads
1,214,942
Messages
6,122,366
Members
449,080
Latest member
Armadillos

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top