DonnaDiablo
10-21-2009, 05:55 AM
Hello...
I have a Workbook with 2 worksheets on it. The User HAS to enable Macros or they get a Worksheet telling them to reopen and Enable Macros and the Main worksheet is hidden. The code for that is here:
When they ENABLE Macros they get in to my main Worksheet which has code for Command Buttons and Special Functions, as follows:
Private Sub CommandButton1_Click() ' Save ONLY
ThisWorkbook.Save
End Sub
Private Sub CommandButton2_Click() 'Exit Without Saving
ThisWorkbook.Close
End Sub
Private Sub CommandButton3_Click() 'Save then Exit
ThisWorkbook.Save
ThisWorkbook.Close
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 4 Then
Target.Offset(0, 1) = Environ("username")
End If
End Sub
The troubles is, i can't get the Command Buttons to work at all.
SAVE does nothing. SAVE and EXIT quite happily exits the workbook, but when i go in it again it hasn't saved. EXIT without SAVING works unless i make any changes to the spreadsheet, then it seems to flick into the workbook 'CustomSave' subroutine.
How can i get these Command Buttons to work... it's my first go at them and i'm sure i need to declare a global or public variable - but where?
Any help anyone can give will be gratefully received.
Donna :o)
I have a Workbook with 2 worksheets on it. The User HAS to enable Macros or they get a Worksheet telling them to reopen and Enable Macros and the Main worksheet is hidden. The code for that is here:
When they ENABLE Macros they get in to my main Worksheet which has code for Command Buttons and Special Functions, as follows:
Private Sub CommandButton1_Click() ' Save ONLY
ThisWorkbook.Save
End Sub
Private Sub CommandButton2_Click() 'Exit Without Saving
ThisWorkbook.Close
End Sub
Private Sub CommandButton3_Click() 'Save then Exit
ThisWorkbook.Save
ThisWorkbook.Close
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 4 Then
Target.Offset(0, 1) = Environ("username")
End If
End Sub
The troubles is, i can't get the Command Buttons to work at all.
SAVE does nothing. SAVE and EXIT quite happily exits the workbook, but when i go in it again it hasn't saved. EXIT without SAVING works unless i make any changes to the spreadsheet, then it seems to flick into the workbook 'CustomSave' subroutine.
How can i get these Command Buttons to work... it's my first go at them and i'm sure i need to declare a global or public variable - but where?
Any help anyone can give will be gratefully received.
Donna :o)