ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Macro Copy Worksheet Name into worksheet A1 (https://www.excelbanter.com/excel-worksheet-functions/160894-macro-copy-worksheet-name-into-worksheet-a1.html)

bmac

Macro Copy Worksheet Name into worksheet A1
 
I have a 50 page workbook. I would like to create a macro to copy each
Worksheet name into each of their perspective A1 cells.

A1 in worksheet1 would display Worksheet1
A1 in worksheet2 would display Worksheet2

thank you
--
bmac

FSt1

Macro Copy Worksheet Name into worksheet A1
 
hi
Sub namesheets()
Dim ws As Worksheet
For Each ws In Worksheets
ws.Cells(1, 1).Value = ws.Name
Next ws
msgbox Done
End Sub

"bmac" wrote:

I have a 50 page workbook. I would like to create a macro to copy each
Worksheet name into each of their perspective A1 cells.

A1 in worksheet1 would display Worksheet1
A1 in worksheet2 would display Worksheet2

thank you
--
bmac


Ron de Bruin

Macro Copy Worksheet Name into worksheet A1
 
Hi bmac

You can use a worksheet function if you want ?
http://www.xldynamic.com/source/xld.xlFAQ0002.html

If you want code post back

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"bmac" wrote in message ...
I have a 50 page workbook. I would like to create a macro to copy each
Worksheet name into each of their perspective A1 cells.

A1 in worksheet1 would display Worksheet1
A1 in worksheet2 would display Worksheet2

thank you
--
bmac


bmac

Macro Copy Worksheet Name into worksheet A1
 
thank you all for responding so quickly.
I found what I was looking for in this function:

=MID(CELL("filename",A1), FIND("]", CELL("filename", A1))+ 1, 255)

I will also investigate the links you have all suggesed to me as well.

this group is awsome.


--
bmac


"Ron de Bruin" wrote:

Hi bmac

You can use a worksheet function if you want ?
http://www.xldynamic.com/source/xld.xlFAQ0002.html

If you want code post back

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"bmac" wrote in message ...
I have a 50 page workbook. I would like to create a macro to copy each
Worksheet name into each of their perspective A1 cells.

A1 in worksheet1 would display Worksheet1
A1 in worksheet2 would display Worksheet2

thank you
--
bmac




All times are GMT +1. The time now is 08:01 AM.

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