Find Replace Visual Basic

  • Thread starter Thread starter Kevin
  • Start date Start date
K

Kevin

I am new to VBA/macros, but have create one that prints a series of documents
that are needed each month out of the folders for each month (i.e. Nov, Dec,
Jan). I would like to add to the beginning of the code, a find and replace
function so that I don't have to go into the code prior to running the macro,
find and replace Feb with Mar, Mar with Apr, etc.

I imagine it would have something to do with having an input box where I
would enter Mar or Apr and it would run the find and replace, but I don't
know what the code would look like.
 
By using parametrs you avoid Find/Replace. Say you have code like:
Sheets("Apr").Activate
Find/Replace would result in something like:
Sheets("May").Activate

Instead:

Dim s As String
s = Application.InputBox(Prompt:="Enter month:", Type:=2)
Sheets(s).Activate

This avoids the editting.
 
Back
Top