ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro with a different Header for each Sheet (https://www.excelbanter.com/excel-discussion-misc-queries/45427-macro-different-header-each-sheet.html)

Dragos

Macro with a different Header for each Sheet
 
HELLO,

I have a question for you guys...I have a worksheet with 12 Sheets: A; B; C;
.....K;L.
I would like to record a macro in VBA wich alows me to put in each Sheet a
Header like: Department A for Sheet A, Departement B for Sheet B, etc;
Is this possibile? Please, please help me...I tried all day long !
Thanks
--
Dragos

Rowan

Assuming you wanted the header in Cell A1:

Sub NameThem()
Dim i As Integer
For i = 1 To Sheets.Count
Sheets(i).Range("A1").Value = "Department " & Sheets(i).Name
Next i
End Sub

Hope this helps
Rowan

Dragos wrote:
HELLO,

I have a question for you guys...I have a worksheet with 12 Sheets: A; B; C;
....K;L.
I would like to record a macro in VBA wich alows me to put in each Sheet a
Header like: Department A for Sheet A, Departement B for Sheet B, etc;
Is this possibile? Please, please help me...I tried all day long !
Thanks


Dragos

Yes, this helps a lot!! it works...Thank you !!! ;-))
--
Dragos


"Rowan" wrote:

Assuming you wanted the header in Cell A1:

Sub NameThem()
Dim i As Integer
For i = 1 To Sheets.Count
Sheets(i).Range("A1").Value = "Department " & Sheets(i).Name
Next i
End Sub

Hope this helps
Rowan

Dragos wrote:
HELLO,

I have a question for you guys...I have a worksheet with 12 Sheets: A; B; C;
....K;L.
I would like to record a macro in VBA wich alows me to put in each Sheet a
Header like: Department A for Sheet A, Departement B for Sheet B, etc;
Is this possibile? Please, please help me...I tried all day long !
Thanks




All times are GMT +1. The time now is 02:07 AM.

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