Input boxes

joacro

Board Regular
Joined
Jun 24, 2010
Messages
158
Hi there,

Hope someone can help with my query.

I need an input box to pop up.

Ex: If Range ("B2").value = X(!) THEN
input box should pop up "Please insert amount"
The amount entered should than go into Range ("C2")

Thx in advance
 

Some videos you may like

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
What changes B2 - you or does it contain a formula?
 

joacro

Board Regular
Joined
Jun 24, 2010
Messages
158

ADVERTISEMENT

Hi there VoG,

It contains a drop downbox with the following options
1. X
2. X(!)
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Try this: right click the sheet tab, select View Code and paste in

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim x As Variant
If Target.Address(False, False) = "B2" And Target.Value = "X(!)" Then
    x = Application.InputBox("Enter amount", Type:=1)
    If TypeName(x) = "Boolean" Then Exit Sub
    Application.EnableEvents = False
    Range("C2").Value = x
    Application.EnableEvents = True
End If
End Sub
 

joacro

Board Regular
Joined
Jun 24, 2010
Messages
158

ADVERTISEMENT

Where should i paste the code, in the thisWorkbook or on that specefic sheet?
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
That specific sheet: right click its tab, select View Code and paste in the code.
 

joacro

Board Regular
Joined
Jun 24, 2010
Messages
158
VoG,

It works perfectly

Thank you.

What should i do if there is more cells with that criteria?
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Where are the other cells? In column B and you want to add values to the corresponding cell in column C?
 

Watch MrExcel Video

Forum statistics

Threads
1,122,213
Messages
5,594,870
Members
413,945
Latest member
V51773

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