Find Replace Visual Basic

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.
 
G

Gary''s Student

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top