I'm having difficulty getting my Worksheet_Activate to change my Label.Caption when the worksheet is activated and need some help.
I'm using two worksheets.
One with DATA in Cells and Command Button.
The second sheet is a form that takes the data
and put it into Labels, then prints out the form.
After the print, I return to the First page get the
next record and return to the form and print it out.
If I manually start with sheet 1, then manually
select sheet 2, the Label.Captions are updated.
If I do this from a Command Button they do not
-------------------------------------------------
As I said, the Worksheet_Activate() works
both manually (when I select the sheet tab)
and from the Command Button, but all the
Label.Caption do not....
I know this because the MsgBox's work fine.
Any Idea's whould be a great help
I'm using two worksheets.
One with DATA in Cells and Command Button.
The second sheet is a form that takes the data
and put it into Labels, then prints out the form.
After the print, I return to the First page get the
next record and return to the form and print it out.
If I manually start with sheet 1, then manually
select sheet 2, the Label.Captions are updated.
If I do this from a Command Button they do not
Code:
'----Sheet one------------------------------------------
Private Sub CommandGameSheetPreview_Click()
Dim StartRow As Integer
Dim EndRow As Integer
Dim Msg As String
Dim i As Integer
StartRow = Range("E35")
EndRow = Range("E36")
If StartRow > EndRow Then
Msg = "ERROR" & vbCrLf & "The First Game Sheet be less than the Last Game Sheet!"
MsgBox Msg, vbCritical, APPNAME
End If
Call PageLayout
ActiveSheet.Unprotect "ora"
Sheet = ActiveSheet.Name
Game_Number = "='" & ActiveSheet.Name & "'!R34C7"
Game_Date = "='" & ActiveSheet.Name & "'!R35C7"
Game_Time = "='" & ActiveSheet.Name & "'!R36C7"
Home_Team = "='" & ActiveSheet.Name & "'!R34C9"
Away_Team = "='" & ActiveSheet.Name & "'!R35C9"
Division = "='" & ActiveSheet.Name & "'!R35C11"
Arena = "='" & ActiveSheet.Name & "'!R36C11"
ActiveWorkbook.Names.Add Name:="Game_Number", RefersToR1C1:=Game_Number
ActiveWorkbook.Names.Add Name:="Game_Date", RefersToR1C1:=Game_Date
ActiveWorkbook.Names.Add Name:="Game_Time", RefersToR1C1:=Game_Time
ActiveWorkbook.Names.Add Name:="Home_Team", RefersToR1C1:=Home_Team
ActiveWorkbook.Names.Add Name:="Away_Team", RefersToR1C1:=Away_Team
ActiveWorkbook.Names.Add Name:="Division", RefersToR1C1:=Division
ActiveWorkbook.Names.Add Name:="Arena", RefersToR1C1:=Arena
For i = StartRow To EndRow
Range("E34") = i
Sheets("Game Sheet").Select
Sheets("3 games - 4 teams").Select
Next i
ActiveSheet.Protect "ora"
End Sub
'----Sheet two------------------------------------------
Private Sub Worksheet_Activate()
MsgBox "Beginning of Activate"
Label_Game_Number.Caption = Range("A1").Text
Label_Division.Caption = Range("C1").Text
Label_Title.Caption = Range("E1").Text
Label_Game_Time.Caption = Range("U1").Text
Label_Game_Date.Caption = Range("S1").Text
Label_Arena.Caption = Range("L1").Text
Label_Home_Team.Caption = Range("R1").Text
Label_Away_Team.Caption = Range("O1").Text
MsgBox "End of Activate"
End Sub
-------------------------------------------------
As I said, the Worksheet_Activate() works
both manually (when I select the sheet tab)
and from the Command Button, but all the
Label.Caption do not....
I know this because the MsgBox's work fine.
Any Idea's whould be a great help
Last edited by a moderator: