View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Jim F Jim F is offline
external usenet poster
 
Posts: 26
Default Simple VB to Select a Cell if Another Cell Equals a Value

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




"ksawyers" wrote:

Jim,

Sorry, how do I do that?

"Jim F" wrote:

You need to run the code from the workbook changed event.

"ksawyers" wrote:

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!

"Jim F" wrote:

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

"ksawyers" wrote:

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