Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default SheetList - Help with skipping sheets


Hey all, Thanks for your help. I am looking at some code to create
sheetlist, and have something that gives me a list. I now need to hav
it skip the first and last worksheet in the file. Is there any way t
do this? I tried doing a for...next loop, but couldnt get it to work.
Thanks again.

Sub UpdateSheetList()

Dim i As Long, sh As Object
i = 0
For Each sh In Sheets
i = i + 1
Cells(i, 1).Value = sh.Name
Next


End Su

--
trickdo
-----------------------------------------------------------------------
trickdos's Profile: http://www.excelforum.com/member.php...nfo&userid=940
View this thread: http://www.excelforum.com/showthread.php?threadid=26731

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default SheetList - Help with skipping sheets

Try this:
Sub UpdateSheetList()
Dim lngCount As Long
Dim i As Long
Dim wks As Worksheet
i = 0
lngCount = ThisWorkbook.Worksheets.Count
For i = 2 To lngCount - 1
Cells(i - 1, 1).Value = ThisWorkbook.Worksheets(i).Name
Next i
End Sub
-----Original Message-----

Hey all, Thanks for your help. I am looking at some code

to create a
sheetlist, and have something that gives me a list. I

now need to have
it skip the first and last worksheet in the file. Is

there any way to
do this? I tried doing a for...next loop, but couldnt

get it to work.
Thanks again.

Sub UpdateSheetList()

Dim i As Long, sh As Object
i = 0
For Each sh In Sheets
i = i + 1
Cells(i, 1).Value = sh.Name
Next


End Sub


--
trickdos
----------------------------------------------------------

--------------
trickdos's Profile: http://www.excelforum.com/member.php?

action=getinfo&userid=9405
View this thread:

http://www.excelforum.com/showthread...hreadid=267316

.

Reply
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
reference row on another sheet skipping zeros but not skipping li. Brennan Downes Excel Discussion (Misc queries) 2 April 2nd 23 01:28 PM
Skipping rows Rob Excel Worksheet Functions 1 March 4th 10 04:52 PM
Skipping Blanks (Again) F. Lawrence Kulchar Excel Discussion (Misc queries) 3 March 7th 08 10:43 PM
Skipping Blanks F. Lawrence Kulchar Excel Discussion (Misc queries) 1 March 7th 08 11:27 AM
SKIPPING A COLUMN eternal_cat via OfficeKB.com Excel Worksheet Functions 1 October 14th 05 06:26 AM


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