T
Tanya
Thank you Basilisk for your Patience with me.
I have been doing some research and finally have the macro working, however
it is at a cost...
This is the successful macro:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Const SHEET_WITH_BUTTON = "Setup"
Const SHEET_WITH_CHANGE_CELL = "1"
Const CHANGE_CELL_ADDRESS = "$B$1"
Const BUTTON_NAME = "CommandButton1"
If StrComp(Sh.Name, SHEET_WITH_CHANGE_CELL, vbTextCompare) = 0 Then
If Target.Address = CHANGE_CELL_ADDRESS Then
Me.Worksheets(SHEET_WITH_BUTTON).OLEObjects(BUTTON_NAME). _
Object.Caption = Target.Text
End If
End If
End Sub
The problem lay in the fact that I had another macro:
Private Sub Protect_Workbook_Click()
'Protect workbook
Dim ws As Worksheet
Const PWORD As String = "BBHS"
For Each ws In ActiveWorkbook.Worksheets
With ws
If ws.ProtectContents = False Then
.EnableSelection = xlUnlockedCells
.Protect Password:=PWORD
End If
End With
Next ws
ActiveWorkbook.Protect Password:=PWORD
End Sub
At least... I think the problem was that the workbook was protected?
I am still working on this...
I have spent heaps of time on this, but it hasn't been wasted, I've cleaned
up the workbook modules
I will keep you posted, if you have any suggestions, I would greatly
appreciate them.
Cheers
Tanya
I have been doing some research and finally have the macro working, however
it is at a cost...
This is the successful macro:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Const SHEET_WITH_BUTTON = "Setup"
Const SHEET_WITH_CHANGE_CELL = "1"
Const CHANGE_CELL_ADDRESS = "$B$1"
Const BUTTON_NAME = "CommandButton1"
If StrComp(Sh.Name, SHEET_WITH_CHANGE_CELL, vbTextCompare) = 0 Then
If Target.Address = CHANGE_CELL_ADDRESS Then
Me.Worksheets(SHEET_WITH_BUTTON).OLEObjects(BUTTON_NAME). _
Object.Caption = Target.Text
End If
End If
End Sub
The problem lay in the fact that I had another macro:
Private Sub Protect_Workbook_Click()
'Protect workbook
Dim ws As Worksheet
Const PWORD As String = "BBHS"
For Each ws In ActiveWorkbook.Worksheets
With ws
If ws.ProtectContents = False Then
.EnableSelection = xlUnlockedCells
.Protect Password:=PWORD
End If
End With
Next ws
ActiveWorkbook.Protect Password:=PWORD
End Sub
At least... I think the problem was that the workbook was protected?
I am still working on this...
I have spent heaps of time on this, but it hasn't been wasted, I've cleaned
up the workbook modules
I will keep you posted, if you have any suggestions, I would greatly
appreciate them.
Cheers
Tanya