Macro? VBA? or easier?

  • Thread starter Thread starter Sandy
  • Start date Start date
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
 
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
 
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
 
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
| >>
| >
| >
|
|
 

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

Back
Top