Here is what I have in module1:
A few notes about it.
I noticed that the Public MainWorkSheet is missing a "s" and it is not
defined inside the open sub.
Notices the "s" on the line Set MainWorksSheet .
If I try to fix this, this causes me another problem and still doesnt
solve my month() problem.
If i declare a public MainWorksSheet or a DIM MainWorksSheet as
Worksheet inside the sub then
MainWorksSheet.CommandButtonAdd.Enabled = True
MainWorksSheet.CommandButtonMakeBusy.Caption = "Start"
stops working????
(These are two buttons created in the sheet for interaction using the
toolbox)
Untli someones explain this to me I dont know what is going on.
Thanks for the help.
=================================
Option Explicit
Public MainWorkSheet as worksheet
sub open ()
Dim StartWeekRange, EndWeekRange As Range
Dim TempWeekday As Integer
Dim WorkingPath As String
Set MainWorksSheet = ThisWorkbook.Worksheets("Main")
Set StartWeekRange = MainWorksSheet.Range("H2")
Set EndWeekRange = MainWorksSheet.Range("J2")
MainWorksSheet.CommandButtonAdd.Enabled = True
MainWorksSheet.CommandButtonMakeBusy.Caption = "Start"
MainWorksSheet.TextBoxAccount.Value = ""
MainWorksSheet.TextBoxNotes.Value = ""
TodayWeekDay = ""
TempWeekday = Weekday(Date)
'if new month call UpdateWeeklyValues("New Month")
'new week
'MsgBox Month(Sheets("Main").Range("b19").Value)
StartWeekRange.Value = (Date - (TempWeekday - 2))
EndWeekRange.Value = (Date + (7 - TempWeekday))
'Dim TempMonth
'If Date < DateSerial(Year(Date), Month(Date) + 1, 0) Then
'MsgBox (Month(MainWorksSheet.Range("B19").Value))
'End If
'TempMonth = Month(MainWorksSheet.Range("B19").Value)
'TempMonth = (DateSerial(Year(Date),
Month(MainWorksSheet.Range("B19").Value), 1)) '
Month(MainWorksSheet.Range("B19").Value)
'If Month(MainWorksSheet.Range("B19").Value) <
(DateSerial(Year(Date), Month(Date), 1)) Then
'UpdateWeeklyValues ("New Month")
'End If
If MainWorksSheet.Range("B19").Value <> Date Then
'add another work day to the monthly sheet
ThisWorkbook.Worksheets("MonthlyTrack").Range("L8").Value =
ThisWorkbook.Worksheets("MonthlyTrack").Range("L8").Value + 1
MainWorksSheet.LabelMakeBusy.Caption = "00:00:00"
MainWorksSheet.Range("B19").Value = Date
End If
MainWorksSheet.Activate
MainWorksSheet.Range("A1").Select
end sub