Data Valid - refers to the values of 2 cells

A

ash3154

How would I insert in my input box of data validation the values of cells D6
and F4

basically if the user clicks on a cell F6 I want it to reference f4 and d6
if they are in cell f8 I would like it to reference f4 and d8
if they are in cell ax106 I would like to refernece ax4 and d106... so on.
 
B

Bernie Deitrick

You cannot use a union as the source of a list, so I would simply reference both cells somewhere
else, say =F4 in cell F100 and =D6 in cell F101 and then use F100:F101 as the DV list source. You
can then copy those cells across the sheet as needed.
 
A

ash3154

Thanks Bernie --
I am in cell F6 -- I click on Data Validation, click input message, under
input message box I type in =f100:f101: What I like to do is to show the
values of cells f100 and 101 when I click on F6. Is that even possible?

( Right now I get a message box with =f100:F101)
 
B

Bernie Deitrick

Choose "List" as your option and select F100:F101 in the range selector box.

HTH,
Bernie
MS Excel MVP
 
A

ash3154

Hi Bernie,

I already have data in F6, All I would like is a message box which shows the
values of D6,F4.
 
B

Bernie Deitrick

You could use a macro:

Sub Macro1()
Dim myC
For Each myC In Range("F6:AX6")
With myC.Validation
.Delete
.Add Type:=xlValidateInputOnly
.InputTitle = "These are those values!"
.InputMessage = myC.Offset(0, -2).Value & ", " & myC.Offset(-2, 0).Value
.ShowInput = True
End With
Next myC
End Sub

You could run the macro from the change event, if any of those values are changed.

HTH,
Bernie
MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top