I am looking for a macro that gives sheet names of w/book next to current
sheet.
Suppose I place this macro in sheet 6 ,from sheet 7 to end of W/book sheet
names be listed in this sheet 6 from range A2:A100.Any body Pl. try and post
me.
Sub wsnames()
Set r = Sheets(1).Range(quot;a1quot;)
For i = 1 To Sheets.Count
r.Cells(i, 1) = Sheets(i).Name
Next i
End Sub
Because this code names all the sheets;
You can alter the code to Sheet(6), and add;
Range(quot;A1:A6quot;).Select
Selection.ClearContents
after Next i--
davesexcel
------------------------------------------------------------------------
davesexcel's Profile: www.excelforum.com/member.php...oamp;userid=31708
View this thread: www.excelforum.com/showthread...hreadid=520043THANKS.very good idea.In last line I have added (instead of clearcontents)
selection.Delete Shift:= xlUp.
quot;davesexcelquot; wrote:
gt;
gt; Sub wsnames()
gt; Set r = Sheets(1).Range(quot;a1quot;)
gt; For i = 1 To Sheets.Count
gt; r.Cells(i, 1) = Sheets(i).Name
gt; Next i
gt; End Sub
gt;
gt; Because this code names all the sheets;
gt; You can alter the code to Sheet(6), and add;
gt; Range(quot;A1:A6quot;).Select
gt; Selection.ClearContents
gt; after Next i
gt;
gt;
gt; --
gt; davesexcel
gt; ------------------------------------------------------------------------
gt; davesexcel's Profile: www.excelforum.com/member.php...oamp;userid=31708
gt; View this thread: www.excelforum.com/showthread...hreadid=520043
gt;
gt;
- May 27 Tue 2008 20:44
Macro for part of W/book sheets
close
全站熱搜
留言列表
發表留言
留言列表

