Excel VBA Use Message Box user response to replace info

larican

New Member
Joined
Apr 9, 2007
Messages
8
I have a report that is linked with formulas that point to monthly folders and therefore as part of the monthly reports need to update all workbooks.....I am using message boxes that the user inpupts the month into and it will use that data to save the reports, etc.

Now, since I need to update formulas, I want to use the data the user inputs to do a find/replace as the macro opens up a wokrbook, updates, saves, and prints that report.

So, I know I may be wayyyy offf as an accountant, this was not a class in college, lol

Please see if I am even close to what I should be doing or should I use something else...anyyyy help I will appreciate


Basically I need to replace last's month info (i.e. 01-09 to be replaced02-09 in Febs reports) and the user is who is telling the macro what months to replace with what data....Thanks for taking the time to read and help


Sub CurrentMonth ()
Dim message As String
Dim userresponse As String


message = _
"Type in a two (2) digit Report Month and Year." & vbCrLf & _
"" & vbCrLf & _
" MM-YY"

TitlebarTxt = "Enter Report Month"

defaultTxt = ""


userresponse = InputBox(message, TitlebarTxt, defaultTxt)

End Sub


=============================

Sub PreviousMonth()

Dim message As String
Dim userresponse2 As String


message = _
"Type in a two (2) digit Report Month and Year." & vbCrLf & _
" FOR LAST MONTHS REPORT DATE" & vbCrLf & _
"" & vbCrLf & _
" MM-YY"

TitlebarTxt = "Enter Last Month's Report Month"

defaultTxt = ""


userresponse2 = InputBox(message, TitlebarTxt, defaultTxt)

End Sub
=======================

Sub Update Reports()

Columns("E:F").Select
Selection.Replace What:=userresponse2, Replacement:=userresponse

End Sub
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

Forum statistics

Threads
1,206,754
Messages
6,074,752
Members
446,083
Latest member
kfunt

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