ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How can I label a worksheet based on a cell in Excel? (https://www.excelbanter.com/excel-worksheet-functions/73840-how-can-i-label-worksheet-based-cell-excel.html)

khartline

How can I label a worksheet based on a cell in Excel?
 
I have a workbook with multiple worksheets and would like to know if there is
a way to label each worksheet based on info in cells on the first worksheet
of the workbook.

Don't know if this is even possible. The labels for the worksheets would be
text, not numbers or dates. Anyone know the answer to this one?

Gary''s Student

How can I label a worksheet based on a cell in Excel?
 
Here is a three sheet example. I am assuming that the first sheet has the
list of tab names in column A:


Sub Macro1()
' gsnu
Sheets(1).Name = Sheets(1).Cells(1, 1).Value
Sheets(2).Name = Sheets(1).Cells(2, 1).Value
Sheets(3).Name = Sheets(1).Cells(3, 1).Value
End Sub



--
Gary's Student


"khartline" wrote:

I have a workbook with multiple worksheets and would like to know if there is
a way to label each worksheet based on info in cells on the first worksheet
of the workbook.

Don't know if this is even possible. The labels for the worksheets would be
text, not numbers or dates. Anyone know the answer to this one?


khartline

How can I label a worksheet based on a cell in Excel?
 
Gary,

Thanks for the info. Can you tell me where to enter the macro code so this
will happen? Names are in column A, starting with line 11. How will that
change the code you posted.

Thanks for the reply. This is super helpful!
Karen

"Gary''s Student" wrote:

Here is a three sheet example. I am assuming that the first sheet has the
list of tab names in column A:


Sub Macro1()
' gsnu
Sheets(1).Name = Sheets(1).Cells(1, 1).Value
Sheets(2).Name = Sheets(1).Cells(2, 1).Value
Sheets(3).Name = Sheets(1).Cells(3, 1).Value
End Sub



--
Gary's Student


"khartline" wrote:

I have a workbook with multiple worksheets and would like to know if there is
a way to label each worksheet based on info in cells on the first worksheet
of the workbook.

Don't know if this is even possible. The labels for the worksheets would be
text, not numbers or dates. Anyone know the answer to this one?


Gary''s Student

How can I label a worksheet based on a cell in Excel?
 
If the data starts at l;ine 11 rather than lin 1 then:


Sub Macro1()
' gsnu
Sheets(1).Name = Sheets(1).Cells(11, 1).Value
Sheets(2).Name = Sheets(1).Cells(12, 1).Value
Sheets(3).Name = Sheets(1).Cells(13, 1).Value
End Sub

Put it in a module. For further instructions see:


http://www.cpearson.com/excel/vbe.htm
--
Gary''s Student


"khartline" wrote:

Gary,

Thanks for the info. Can you tell me where to enter the macro code so this
will happen? Names are in column A, starting with line 11. How will that
change the code you posted.

Thanks for the reply. This is super helpful!
Karen

"Gary''s Student" wrote:

Here is a three sheet example. I am assuming that the first sheet has the
list of tab names in column A:


Sub Macro1()
' gsnu
Sheets(1).Name = Sheets(1).Cells(1, 1).Value
Sheets(2).Name = Sheets(1).Cells(2, 1).Value
Sheets(3).Name = Sheets(1).Cells(3, 1).Value
End Sub



--
Gary's Student


"khartline" wrote:

I have a workbook with multiple worksheets and would like to know if there is
a way to label each worksheet based on info in cells on the first worksheet
of the workbook.

Don't know if this is even possible. The labels for the worksheets would be
text, not numbers or dates. Anyone know the answer to this one?


Karen

How can I label a worksheet based on a cell in Excel?
 
This is great and for the most part, is working. One more question...

It looks like when I enter the code below and have it listed for the 65
worksheets in the book, if not all 65 cells are filled in it gives me an
error message in Microsoft Visual basic of "400".

Two questions:
Is there a way to include an IF statement so if all 65 cells do not have
data in them, it's ok?

Is there a way to have this auto input the cell data into the tab or will I
have to go to TOOLS, MACROS, RUN each time I want the data to show up?

Thanks for your help!

"Gary''s Student" wrote:

If the data starts at l;ine 11 rather than lin 1 then:


Sub Macro1()
' gsnu
Sheets(1).Name = Sheets(1).Cells(11, 1).Value
Sheets(2).Name = Sheets(1).Cells(12, 1).Value
Sheets(3).Name = Sheets(1).Cells(13, 1).Value
End Sub

Put it in a module. For further instructions see:


http://www.cpearson.com/excel/vbe.htm
--
Gary''s Student


"khartline" wrote:

Gary,

Thanks for the info. Can you tell me where to enter the macro code so this
will happen? Names are in column A, starting with line 11. How will that
change the code you posted.

Thanks for the reply. This is super helpful!
Karen

"Gary''s Student" wrote:

Here is a three sheet example. I am assuming that the first sheet has the
list of tab names in column A:


Sub Macro1()
' gsnu
Sheets(1).Name = Sheets(1).Cells(1, 1).Value
Sheets(2).Name = Sheets(1).Cells(2, 1).Value
Sheets(3).Name = Sheets(1).Cells(3, 1).Value
End Sub



--
Gary's Student


"khartline" wrote:

I have a workbook with multiple worksheets and would like to know if there is
a way to label each worksheet based on info in cells on the first worksheet
of the workbook.

Don't know if this is even possible. The labels for the worksheets would be
text, not numbers or dates. Anyone know the answer to this one?



All times are GMT +1. The time now is 01:58 PM.

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