Simple VB to Select a Cell if Another Cell Equals a Value

G

Guest

Hi!

I'm looking for simple VB code that says if Cell A1 = "X" then select cell
Y. If Cell Y is selected I want a box that pops up to prompt the user to
enter the information. Is that possible? I saw something similar, but I
can't seem to get it to work. Any help would be extremely appreciated.

Best regards,
Kerrick Sawyers
 
G

Guest

ksawyers said:
Hi!

I'm looking for simple VB code that says if Cell A1 = "X" then select cell
Y. If Cell Y is selected I want a box that pops up to prompt the user to
enter the information. Is that possible? I saw something similar, but I
can't seem to get it to work. Any help would be extremely appreciated.

Best regards,
Kerrick Sawyers
 
G

Guest

Sub selectAndPopulateNewCell()
If UCase(Range("A1").Value) = "X" And Range("Y1").Value = "" Then
Range("Y1").FormulaR1C1 = InputBox("Enter Value Here")
End If
End Sub
 
G

Guest

Thanks Jim! Unfortunately that didn't work. I have a range of cells that I
named and tried to insert in the formula but nothing happens when I enter the
value in the cell (A1) - actually I have a dropdown in the cell with options
to select. When I select the option, I want it to jump to the other cell and
if blank prompt for the new information. I'll keep trying. Thanks!
 
G

Guest

Ok...
1. Open VBA Editor.
2. Click on "ThisWorkbook" in the VBA project section (to the left of the
editor).
3. In the first dropdown list (at top of editor) choose "workbook"
4. In the sencond drop down (at top of editor) choose "SheetChange"
It should automatically add some code:
5. between the "private sub" and "end sub" statments copy the following code:

If UCase(Range("A1").Value) = "X" And Range("Y1").Value = "" Then
Range("Y1").FormulaR1C1 = InputBox("Enter Value Here")
End If
 
G

Guest

Thanks Jim!

Jim F said:
Ok...
1. Open VBA Editor.
2. Click on "ThisWorkbook" in the VBA project section (to the left of the
editor).
3. In the first dropdown list (at top of editor) choose "workbook"
4. In the sencond drop down (at top of editor) choose "SheetChange"
It should automatically add some code:
5. between the "private sub" and "end sub" statments copy the following code:

If UCase(Range("A1").Value) = "X" And Range("Y1").Value = "" Then
Range("Y1").FormulaR1C1 = InputBox("Enter Value Here")
End If
 

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