InputBox questions.....multiple responses possible?

Darth yoda

New Member
Joined
Feb 27, 2013
Messages
35
Hi again guys. I really appreciate your help guys. I have learned a lot. But learning leads to learning!! LOL.

After finishing my other spreadsheet I have decided to learn InputBoxes. This is a multiple question thread all relating to InputBox. So once again.............

1a. When opening Excel, an InputBox("What is your name?") should popup. When answered (Bob) the workbook should "copy as Bob" and save itself. The InputBox should not show itself on re-opening. This way there is always an unmodified copy on hand.

OR

1b. When opening Excel, an InputBox("Have you backed up your data?") should popup. If No another InputBox("Please quit and back up your data.") should show with a close button.
If Yes then the original InputBox should never show again.

Is there a limit to the numbers of questions asked in a single InputBox?
2. Now an InputBox(" What is number one?","What is number two?") all the way to number 6 and place in cell f5, f6, f7 etc.. Then close after all are answered.

How to call an InputBox from an InputBox?
3. Another Input Box should popup and ask InputBox(" Is your commission static or variable?") If "S" then InputBox("What is your commission level?") else InputBox("Enter Number.") then produce a random number. RandomNumber(1 thru Enter Number) and place it in sheet2.cellG3.

How to make notations in a macro? Like this......
LastRow = Worksheets("Sheet2").Cells(Rows.Count, "A").End(xlUp).Row :This counts the rows in column "A".

Thanks again for all the help. You guys rock!!
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Darth Yoda,

1 - Yes this can be done.... In the workbook open event, you want to test to see if the name is the default (I used Junk.xls). If it is the default then use your inputbox and save as

Code:
Private Sub Workbook_Open()
Dim sName As String
If ThisWorkbook.Name = "Junk.xls" Then 'change Junk.xls to the name of the workbook
    sName = InputBox("What is your name?")
    ThisWorkbook.SaveAs Filename:=sName & ".xls"
End If
End Sub


2- You could, in theory answer several questions in a single inputbox and split the result into various cells using the split function or some mixture of mid/find but this is very easy for the user to mess up.

3- you could use an if then based on the result of one inputbox to get more data from the user. Again, this is easy to mess up. What if the user enters information that is not one of your choices?

I suggest you create a userform and control the questions with drop downs, text boxes and check boxes/radio buttons. This would be a much better way to control the data coming in.

Good luck.
 
Upvote 0
Hi again guys. I really appreciate your help guys. I have learned a lot. But learning leads to learning!! LOL.

After finishing my other spreadsheet I have decided to learn InputBoxes. This is a multiple question thread all relating to InputBox. So once again.............

1a. When opening Excel, an InputBox("What is your name?") should popup. When answered (Bob) the workbook should "copy as Bob" and save itself. The InputBox should not show itself on re-opening. This way there is always an unmodified copy on hand.

OR

1b. When opening Excel, an InputBox("Have you backed up your data?") should popup. If No another InputBox("Please quit and back up your data.") should show with a close button.
If Yes then the original InputBox should never show again.

Is there a limit to the numbers of questions asked in a single InputBox?
2. Now an InputBox(" What is number one?","What is number two?") all the way to number 6 and place in cell f5, f6, f7 etc.. Then close after all are answered.

How to call an InputBox from an InputBox?
3. Another Input Box should popup and ask InputBox(" Is your commission static or variable?") If "S" then InputBox("What is your commission level?") else InputBox("Enter Number.") then produce a random number. RandomNumber(1 thru Enter Number) and place it in sheet2.cellG3.

How to make notations in a macro? Like this......
LastRow = Worksheets("Sheet2").Cells(Rows.Count, "A").End(xlUp).Row :This counts the rows in column "A".

Thanks again for all the help. You guys rock!!

The link below is about using inputbox with Excel VBA.

The VBA InputBox Command - VBA macros
 
Upvote 0
Thanks!! Worked great except a minor change.................

Code:
Private Sub Workbook_Open()
Dim sName As String
If ThisWorkbook.Name = "Junk.xlsm" Then 'change Junk.xls to the name of the workbook
    sName = InputBox("What is your name?")
    ThisWorkbook.SaveAs Filename:=sName & ".xlsm"
End If
End Sub

Had to be .xlsm Thanks again!
 
Upvote 0

Forum statistics

Threads
1,202,902
Messages
6,052,451
Members
444,582
Latest member
Scramble

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