Macro? VBA? or easier?

S

Sandy

Hi
I have a range of cells C6:K6 which contains numbers from 3 to 9.
In a second range C18:K18 I would like to have the following (if possible):

If C6 = 3 then C18 = "X" otherwise if C6 > 3 then Insert a drop-down box
with values "Yes" and "No".

Can this be done?

Sandy
 
B

Bernie Deitrick

Sandy,

You could use a macro. Try the code below.

HTH,
Bernie
MS Excel MVP

Sub SandyMacro()
Dim myCell As Range
For Each myCell In Range("C6:K6")
With myCell.Offset(12)
If myCell.Value = 3 Then
.Validation.Delete
.Value = "X"
Else
With .Validation
.Delete
.Add Type:=xlValidateList, Formula1:="Yes,No"
.IgnoreBlank = True
.InCellDropdown = True
End With
End If
End With
Next myCell
End Sub
 
S

Sandy

Bernie

The code works well, thank you.

Could it however be adjusted to run automatically when say the final value
for the range C6:K6 is entered in K6?

Sorry to be a pest but my coding capability is useless.

Sandy
 
J

Jim Rech

Far easier to put a button next to the last cell, attached to this macro,
that says "Click to update row 18".

--
Jim
| Bernie
|
| The code works well, thank you.
|
| Could it however be adjusted to run automatically when say the final value
| for the range C6:K6 is entered in K6?
|
| Sorry to be a pest but my coding capability is useless.
|
| Sandy
|
| | > Sandy,
| >
| > You could use a macro. Try the code below.
| >
| > HTH,
| > Bernie
| > MS Excel MVP
| >
| > Sub SandyMacro()
| > Dim myCell As Range
| > For Each myCell In Range("C6:K6")
| > With myCell.Offset(12)
| > If myCell.Value = 3 Then
| > .Validation.Delete
| > .Value = "X"
| > Else
| > With .Validation
| > .Delete
| > .Add Type:=xlValidateList, Formula1:="Yes,No"
| > .IgnoreBlank = True
| > .InCellDropdown = True
| > End With
| > End If
| > End With
| > Next myCell
| > End Sub
| >
| > | >> Hi
| >> I have a range of cells C6:K6 which contains numbers from 3 to 9.
| >> In a second range C18:K18 I would like to have the following (if
| >> possible):
| >>
| >> If C6 = 3 then C18 = "X" otherwise if C6 > 3 then Insert a drop-down
box
| >> with values "Yes" and "No".
| >>
| >> Can this be done?
| >>
| >> Sandy
| >>
| >
| >
|
|
 
Top