View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.programming
Jake Marx[_3_] Jake Marx[_3_] is offline
external usenet poster
 
Posts: 860
Default Loop through Worksheet Names

OK - another modification thanks to onedaywhen.

The For Next loop should now look like this:

For Each axTab In axCat.Tables
Select Case Right$(axTab.Name, 1)
Case "$"
ReDim Preserve asSheets(0 To nShtNum)
asSheets(nShtNum) = Left$(axTab.Name, _
Len(axTab.Name) - 1)
nShtNum = nShtNum + 1
Case "'"
If Mid$(axTab.Name, Len(axTab.Name) - 1, 1) _
= "$" And Left$(axTab.Name, 1) = "'" Then
ReDim Preserve asSheets(0 To nShtNum)
asSheets(nShtNum) = Mid$(axTab.Name, _
2, Len(axTab.Name) - 3)
nShtNum = nShtNum + 1
End If
End Select
Next axTab

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]