Hi i have problem with a long code.
So I divided that code in 4 parts.
So I have
module1 -> Sub Macro1()
module2 -> Sub Macro2()
module3 -> Sub Macro3()
module4 -> Sub Macro4()
I have declared
all my sub have the following structure:
myEnter is declared as Integer and it's initial value is 0
but if I run it at 7.41 I will miss the update and it will not go inside
The problem is when for example in macro4 I have

any suggests?
So I divided that code in 4 parts.
So I have
module1 -> Sub Macro1()
module2 -> Sub Macro2()
module3 -> Sub Macro3()
module4 -> Sub Macro4()
I have declared
Option Explicit
Dim mdNextTime1 As Double
Dim myEnter As Integer
'Dim myK1 As Integer
'Dim myK2 As Integer
'Dim myK3 As Integer
Dim myK4 As Integer
Const myC As Integer = 82
Dim Lastrow As Integer
Dim myActualRow As Integer
all my sub have the following structure:
Sub Macro1()
'If (myK1 = 0) Then
' myEnter = myC
' myK1 = 1
'End If
With Sheets("Sheet1").Range("J2")
'7.40
If .Value >= TimeSerial(7, 0, 0) And .Value < TimeSerial(7, 40, 0) Then
With ThisWorkbook
...
End With
If (myEnter = 0) Then
...
myEnter = 1
End If
End If
'8.00
If .Value >= TimeSerial(7, 40, 0) And .Value < TimeSerial(8, 0, 0) Then
With ThisWorkbook
...
End With
If (myEnter = 1) Then
...
myEnter = 2
End If
End If
'8.00
If .Value >= TimeSerial(8, 0, 0) And .Value < TimeSerial(8, 40, 0) Then
With ThisWorkbook
...
End With
If (myEnter = 2) Then
...
myEnter = 3
End If
End If
...
and so on
myEnter is declared as Integer and it's initial value is 0
The question is that if I start the macro at 7.00 everything run ok because myEnter Updates itselfDim myEnter As Integer
but if I run it at 7.41 I will miss the update and it will not go inside
So i thought...well let's use thisIf (myEnter = 2) Then
...
myEnter = 3
and if I declare myC asIf (myK1 = 0) Then
myEnter = myC
myK1 = 1
End If
I should revolve this.Const myC As Integer = 1
The problem is when for example in macro4 I have
myEnter doesn't have that value, but it's emptyIf (myK4 = 0) Then
myEnter = myC
myK4 = 1
'MsgBox myEnter
End If
any suggests?