vba courses london - vba
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft VBA Training and help » vba courses london - VBA

vba courses london - VBA

resolvedResolved · Low Priority · Version Standard

replyReply Thu 18 Jan 2007, 16:04Delegate Nick said...

VBA

How can i use VBA to run an edit and replace function multiple times with different values for find and replace each time to create multiple documents by save as.

For upcoming training course dates see: Pricing & availability

replyReply Fri 26 Jan 2007, 11:47Trainer Carlos said...

RE: VBA

All you need to do is create a loop that after editing the document saves it under a different name eg

Sub EditRoutine

Dim Sheet As Worksheet
Dim SheetName As String

For Each Sheet In ActiveWorkbook.Worksheets

SheetName = Sheet.Name

<Run Edit/Replace Function>

Sheet.Save As "C:\My Documents\New" & SheetName

Next Sheet

End Sub

 

Vba tip:

Stuck in a Code Loop

If you ever get stuck in an infinite code loop when programing in VBA use

CTRL+BREAK

to exit the procedure

View all VBA hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard