View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Count elements in array

SheetsToPrintSplit = Split(SheetsToPrint, ",")

For iCounter = 0 To UBound(SheetsToPrintSplit)
Sheets(Clng(SheetsToPrintSplit(iCounter))).PrintOu t
Next


You don't need to increment icounter.

--
Regards,
Tom Ogilvy




"Jason Morin" wrote in message
...
Hello and TIA. Users input a string into a InputBox in
the #,# format. For example:

SheetsToPrint = "1,3,8,14"

This indicates which sheets (index #) they want to print.
The macro is printing but I'm having issues determing the
total elements in my array, and thus all sheets selected
won't print:

SheetsToPrintSplit = Split(SheetsToPrint, ",")

For iCounter = 0 To UBound(SheetsToPrintSplit)
Sheets(CInt(SheetsToPrintSplit(iCounter))).PrintOu t
iCounter = iCounter + 1
Next