Pop Up Box

vandango05

Board Regular
Joined
Oct 6, 2008
Messages
110
Hi all.

I've been doing a bit of searching but not yet found it if this is possible.

When a workbook is opened for the first time I wonder if it possible for a message to appear like this?

"Please enter your delivery rate"

I would then need our customer to write a value that would then be stored in a particular cell.

Is anything like this possible?

Thank you for reading
 
Hi

You could place the following in the ThisWorkbook module of the workbook concerned - it will be activated (assuming the user enables macros) when the workbook is opened:

Code:
Private Sub Workbook_Open()
dim retval
retval = Application.InputBox("Please enter a delivery rate", "Rate", Type:=1)
If retval <> False Then
   Sheets("SomeSheet").Range("A1").Value = retval
End If
End Sub

Change the sheet name and the specific cell.
 
Upvote 0
Thank you for your quick reply. It runs through and works great when I test it in the VB window, although it does not run when the file is opened.

Anything I'm doing wrong?
 
Upvote 0
I believe so.

I've tried 2 ways.

Opening the file and pressing ALT+F11

Inserting a New Module and pasting the code

Private Sub Workbook_Open()
Dim retval
retval = Application.InputBox("Please enter a delivery rate", "Rate", Type:=1)
If retval <> False Then
Sheets("Quotation").Range("S1").Value = retval
End If
End Sub

I've also tried right clicking the sheet and selecting view code and pasting the code on the sheet.

I may be doing it totally wrong i'm not very good when it comes to the VB side of Excel i'm afraid!
 
Upvote 0
When you are in the VBE, the ThisWorkbook module will be listed under the workbook name in the top right Project window (under Microsoft Excel Objects sub category). You definitely do not want to place it in a standard module nor in a worksheet module.

Alternatively, place the following in a standard module:

Code:
Sub Auto_Open()
Dim retval
retval = Application.InputBox("Please enter a delivery rate", "Rate", Type:=1)
If retval <> False Then
Sheets("Quotation").Range("S1").Value = retval
End If
End Sub

The above should work the same.
 
Upvote 0

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
Back
Top