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!
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

Oaktree

MrExcel MVP
Joined
Jun 20, 2002
Messages
8,053
Office Version
  1. 365
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:
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,168,037
Messages
5,856,967
Members
431,843
Latest member
Malahhai

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