Excel &VB - If/ElseIf - how to allow editing if no variables apply

S

Sal

Hello All! I am a struggling new user and probably not even close in the
proper way to use VB, so my apologies if my question makes you cringe!
Here's what I have:

Cell AH68 is connected to 3 radio buttons, which means AH68 will display a
"0" if no buttons are selected
"1" , "2", or "3" depending on which button is selected.

The EXCEL Side:
If AH68 = "0" or "1", a message appears in another cell (W66) stating "This
information is required"; otherwise, if AH68 = "2" or "3", W66 states "N/A".

MY GOAL:
Since the date the sheet is closed is a catalyst for money to be collected,
I have a cell (E74) which is the 'Date Closed' field. If W66 is blank or
shows "This information is required", I want the Date Closed field (E74) to
show "Required Information Missing" and NOT allow editing. If W66 has any
other data in it, I want E74 to be editable.

Below is what I came up with - the last line (before End If) is where I
think I'm stuck. If anyone can help, I'd be very grateful! Thanks!

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)

If Range("AH68").Value = "1" And Range("W66") = "This Information Is
Required" Or Range("AH68").Value = "0" And Range("W66") = "This Information
Is Required" Then
Range("E74") = "Required Information Missing"

ElseIf Range("AH68").Value > "1" And Range("W66") <> "This Information
Is Required" Then
Range("E74") = ??? I need it to be editable - this is where I'm stuck.

End If

End Sub
 
J

JLGWhiz

Range("E74") = ??? I need it to be editable - this is where I'm stuck

Not sure I completely understand, but maybe something like this:

Range("E74") = InputBox("Cell E74 Requires a valid entry!", "VALID ENTRY
REQUIRED")

The InputBox will allow the user to make an entry in cell E74 without having
to stop the macro.
 

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