Macro pause and imput box

MarkReddell

Board Regular
Joined
Sep 1, 2011
Messages
210
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
Hello Message Board!!! I need help with a macro pause with an imput box with that entry going into B4. Can anyone help with this? Code is below! THANX!!!


(Sub SAVE_FILE_AS_CUSTOMER_NAME()

Application.ExecuteExcel4Macro "show.toolbar(""Ribbon"",True)"
MsgBox ("This File is Being Saved in the Customer's Name & to the MSN SkyDrive Web-site In The Business Folder!")
ActiveWorkbook.SaveAs Filename:="https://ptkmnm.docs.live.net/a7f2fe19067884e3/BUSINESS/" & Sheets("LOAN SCENARIOS").Range("BA1").Value & ".xlsm"
If Len(Range("B4")) = 0 Then
Application.Goto Reference:="R4C2"
MyVar = InputBox("Enter the Customer(s) Name")
Else
ActiveWorkbook.SaveAs Filename:="https://ptkmnm.docs.live.net/a7f2fe19067884e3/BUSINESS/" & Sheets("LOAN SCENARIOS").Range("B4").Value & ".xlsm"
End If
End Sub)
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Hi,
A input box would pause the code until that box is dealt with because they are opened modal.

The only reason this would not be working is your if statement my not be firing
 
Upvote 0
THANX 4 YOUR REPLY!!! MY CODE WORX OK EXEPT THAT MY ENTRY INTO THE IMPUT BOX DOESN'T GO INTO CELL "B4". IT GOES NOWHERE ON MY WORKSHEET!!! ANY SUGGESTIONS???? THANX AGAIN! Mark@Reddell.Com
 
Upvote 0
MyVar just holds the value of the InputBox in memory until the macro ends. You have to add code to put the variable value into a cell.

Code:
Range("B4").Value = MyVar
 
Upvote 0
Thanx Dave, That worx!!! One question, If I selected "Cancel" on the Imput Box instead of entering in a Customers name, how would I do that without causing the macro 2 debug?
 
Upvote 0
I generally use:
Code:
'Exits the sub if you don't enter a value or Cancel
MyVar = InputBox("Enter the Customer(s) Name")
If MyVar = False Or MyVar = "" Then
     Exit Sub
    Else
 
ActiveWorkbook.SaveAs Filename:="[URL="https://ptkmnm.docs.live.net/a7f2fe19067884e3/BUSINESS/"][COLOR=#304c6c]https://ptkmnm.docs.live.net/a7f2fe19067884e3/BUSINESS/[/COLOR][/URL]" & Sheets("LOAN SCENARIOS").Range("B4").Value & ".xlsm"
End If
 
End If
 
Upvote 0
Thanx Dave, Good Call!!! That worx perfectly!!! God's Blessings on the U & Family & Merry CHRIST-mas!!!!:)
 
Upvote 0

Forum statistics

Threads
1,216,732
Messages
6,132,408
Members
449,726
Latest member
Skittlebeanz

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