Checking Active Cell Input

Flapjack

Board Regular
Joined
Aug 24, 2005
Messages
59
Office Version
  1. 365
Platform
  1. Windows
I would like to write some code that does the following:

I have a column where the user enters part numbers. Whenever someone enters one part number in particular, I want a dialog box to pop up and have them select from three options. Based on the option they choose, a corresponding part number will then be automatically inserted in that column in the very next row.

I'm new at this, so sorry if this is a basic question, but how do I do an If/Then check on the active cell whenever something is entered? In other words, I am not manually running a macro to check the range of cells. I want it to automatically check the users input and then run the macro if the part number they enter matches a number.

Thanks!
 

Some videos you may like

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Oaktree

MrExcel MVP
Joined
Jun 20, 2002
Messages
7,994
Try a worksheet_change event.

Right click on the tab of the input sheet, select "view code", and put something like:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target = "my part" Then 'rest of code
End Sub
 

Flapjack

Board Regular
Joined
Aug 24, 2005
Messages
59
Office Version
  1. 365
Platform
  1. Windows
Thanks, Oaktree! That's working just how I want it.

Thanks! :biggrin:
 

Watch MrExcel Video

Forum statistics

Threads
1,122,842
Messages
5,598,394
Members
414,234
Latest member
grlevesq

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top