PDA

View Full Version : importing sheet from another file - issue with data validation



jimi.bs
01-01-2020, 08:33 AM
Hey all,

so I am pretty basic with VBA coding and all in excel (using version 2016)

I'm trying to achieve the following, I have various of buttons on my main workbook, that lets me import sheets from a different workbook that I use as templates.
This works all fine, however, in my template sheets, I use data validation to create dropdown lists to select values.

When i import a sheet from my template workbook, it imports just fine, however, the data validation tries to link to the original file, which is not working.
I would like to have the data validation to be looking for a certain sheet name instead, so if I import a new template sheet in my main workbook, this new template sheet will take the data validation from the very same data tab already present in my main workbook.

Hope I make some sense with my problem, and hopefully someone knows how I can solve this.

Thanks!

paulked
01-02-2020, 06:40 AM
In the import macro, delete the validation and add a new one something like:



With Range("F2").Validation
.Delete
.Add Type:=xlValidateList, Formula1:="=Sheet1!F2:F14"
End With