Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello-
I searched around for awhile, but becuase I m not sure exactly what to look for, I could not figure out a way to do this... I am using the following macro to create PDFs of sheets in a book. Dim s As String s = ActiveCell.Worksheet.Name ActiveWorkbook.saveAs Filename:=s Application.Run "EblastMacro2.xls!printAsPDF" ActiveSheet.Next.Select s = ActiveCell.Worksheet.Name ActiveWorkbook.saveAs Filename:=s Application.Run "EblastMacro2.xls!printAsPDF" ActiveSheet.Next.Select How can I write an If statement that will search for the next sheet to run the macro on, but if there isn't a next sheet, then stop the macro. Right now it will work fine, but instead of just stopping, it will give me runtime error message. Any thoughts? Thank you, BBkixx |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
If Range not equal to zero in Visual Basic If/Then statement | Excel Discussion (Misc queries) | |||
How do I write a basic VLOOKUP statement? | New Users to Excel | |||
Basic IF statement? | Excel Discussion (Misc queries) | |||
Micrsoft Visual Basic Compile error: Expected: end of statement | Excel Discussion (Misc queries) | |||
If Statement - Basic | Excel Discussion (Misc queries) |