Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

find (constant & varible) and replace with (contstant)

Status
Not open for further replies.

newbie3

Programmer
Jan 26, 2005
5
US
I'm trying to find and replace 2 new worksheets sometimes "sheet 1" and "sheet 2" and sometimes "sheet 3" and "sheet 4" with the sheet name "city" and "zip".

My macro deletes the sheets "city" and "zip" in the beginning of the macro and adds new worksheets (ie. sometime "sheet 1" and "sheet 2" and replaces them with "city" and "zip" - the only problem is I run the macro several times so when I run the macro a 2nd time it adds sheet 3 and sheet 4 etc.) I'm new at this so hopefull someone can help. I currently only know how to record macros. Thanks!
 
How do you add the new worksheets ?
A starting point:
ActiveWorkbook.Sheets.Add
ActiveSheet.Name="zip"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top