LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Basic If Statement

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
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
If Range not equal to zero in Visual Basic If/Then statement Clinton W Excel Discussion (Misc queries) 3 May 2nd 09 11:17 PM
How do I write a basic VLOOKUP statement? Maureen New Users to Excel 7 September 25th 07 03:22 PM
Basic IF statement? SayWhatAuto Excel Discussion (Misc queries) 4 December 30th 06 11:37 PM
Micrsoft Visual Basic Compile error: Expected: end of statement IJ Excel Discussion (Misc queries) 5 October 23rd 06 12:08 AM
If Statement - Basic Portuga Excel Discussion (Misc queries) 2 January 23rd 06 05:59 PM


All times are GMT +1. The time now is 09:51 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"