ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Runing two macros triggered by a button (https://www.excelbanter.com/excel-discussion-misc-queries/59568-re-runing-two-macros-triggered-button.html)

Paul B

Runing two macros triggered by a button
 
Jack, why not just put them together in one,

Sub nametab()
Dim i As Integer
On Error Resume Next
For i = 1 To Sheets.Count
Sheets(i).Name = Sheets(i).Range("G1").Value
Next i
With ActiveSheet
.PageSetup.CenterFooter = .Range("G1").Text
End With
On Error GoTo 0
End Sub


or like this

Sub nametab()
Dim i As Integer
On Error Resume Next
For i = 1 To Sheets.Count
Sheets(i).Name = Sheets(i).Range("G1").Value
Next i
With ActiveSheet
.PageSetup.CenterFooter = .Range("G1").Text
End With
CellInfooter
On Error GoTo 0
End Sub

Sub CellInfooter()
With ActiveSheet
.PageSetup.CenterFooter = .Range("G1").Text
End With
End Sub


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"JackR" wrote in message
...
I have the first macro set-up to start when a button is clicked, I would

like
bothe the macros to run when then button is clicked, any help would be

great,
not real up on this macro stuff yet.

MACRO 1 (triggered by button)
Sub nametab()
Dim i As Integer
On Error Resume Next
For i = 1 To Sheets.Count
Sheets(i).Name = Sheets(i).Range("G1").Value
Next i
On Error GoTo 0
End Sub

WANT TO ADD THE FOLLOWING TO TRIGGER AT THE SAME TIME
Sub CellInfooter()
With ActiveSheet
.PageSetup.CenterFooter = .Range("G1").Text
End With
End Sub



Thanks




JackR

Runing two macros triggered by a button
 
Thank you, that worked, I knew it would be simple

"Paul B" wrote:

Jack, why not just put them together in one,

Sub nametab()
Dim i As Integer
On Error Resume Next
For i = 1 To Sheets.Count
Sheets(i).Name = Sheets(i).Range("G1").Value
Next i
With ActiveSheet
.PageSetup.CenterFooter = .Range("G1").Text
End With
On Error GoTo 0
End Sub


or like this

Sub nametab()
Dim i As Integer
On Error Resume Next
For i = 1 To Sheets.Count
Sheets(i).Name = Sheets(i).Range("G1").Value
Next i
With ActiveSheet
.PageSetup.CenterFooter = .Range("G1").Text
End With
CellInfooter
On Error GoTo 0
End Sub

Sub CellInfooter()
With ActiveSheet
.PageSetup.CenterFooter = .Range("G1").Text
End With
End Sub


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"JackR" wrote in message
...
I have the first macro set-up to start when a button is clicked, I would

like
bothe the macros to run when then button is clicked, any help would be

great,
not real up on this macro stuff yet.

MACRO 1 (triggered by button)
Sub nametab()
Dim i As Integer
On Error Resume Next
For i = 1 To Sheets.Count
Sheets(i).Name = Sheets(i).Range("G1").Value
Next i
On Error GoTo 0
End Sub

WANT TO ADD THE FOLLOWING TO TRIGGER AT THE SAME TIME
Sub CellInfooter()
With ActiveSheet
.PageSetup.CenterFooter = .Range("G1").Text
End With
End Sub



Thanks






All times are GMT +1. The time now is 03:33 PM.

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