Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 504
Default Find Replace Visual Basic

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Find Replace Visual Basic

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.
--
Gary''s Student - gsnu200835


"Kevin" wrote:

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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find and Replace within workbook - from Visual basic MarkS Excel Programming 2 June 14th 06 06:26 PM
help for Visual Basic Find Lolly[_2_] Excel Programming 3 June 5th 06 04:16 AM
Using FIND in Visual Basic Mike Excel Programming 2 November 7th 05 05:01 PM
Where do I find help for Visual Basic for Applications Extensibili Lee Hunter Excel Programming 2 October 19th 05 05:39 PM
Using Find/Replace in Visual basic to adapt the code Zakynthos Excel Programming 6 September 8th 05 03:41 PM


All times are GMT +1. The time now is 10:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"