ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro for part of W/book sheets (https://www.excelbanter.com/excel-discussion-misc-queries/75870-macro-part-w-book-sheets.html)

TUNGANA KURMA RAJU

Macro for part of W/book sheets
 
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.

davesexcel

Macro for part of W/book sheets
 

Sub wsnames()
Set r = Sheets(1).Range("a1")
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("A1:A6").Select
Selection.ClearContents
after Next i


--
davesexcel
------------------------------------------------------------------------
davesexcel's Profile: http://www.excelforum.com/member.php...o&userid=31708
View this thread: http://www.excelforum.com/showthread...hreadid=520043


TUNGANA KURMA RAJU

Macro for part of W/book sheets
 
THANKS.very good idea.In last line I have added (instead of clearcontents)
selection.Delete Shift:= xlUp.

"davesexcel" wrote:


Sub wsnames()
Set r = Sheets(1).Range("a1")
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("A1:A6").Select
Selection.ClearContents
after Next i


--
davesexcel
------------------------------------------------------------------------
davesexcel's Profile: http://www.excelforum.com/member.php...o&userid=31708
View this thread: http://www.excelforum.com/showthread...hreadid=520043




All times are GMT +1. The time now is 12:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com