hi have this structure
I mean instead of using
Somehow my code crash...and maybe is for this kind of errors
whereWith myTime
If .Value >= TimeSerial(cHour, cMinute, 0) And .Value < TimeSerial(nHour, nMinute, 0) Then
...
Worksheets("Sheet2").range(colSheet2).End(xlUp).Offset(1, 0).PasteSpecial xlValues
'####################
'Count previous column
If (IsEqual = False) Then
If WorksheetFunction.CountA(Sheets("Sheet2").Columns(pIndex)) > 0 Then
Lastrow = Sheets("Sheet2").range(pIndex & Sheets("Sheet2").Rows.Count).End(xlUp).Row
With Worksheets("Sheet2")
'close
'Worksheets("sheet3").range("E65536").End(xlUp).Offset(1, 0) = Worksheets("Sheet2").range(colPrevSheet2).End(xlUp)
...
Could this structure give me any error if I'm instead on the active sheet5?With ThisWorkbook
Set mytime = Worksheets("Sheet1").range("J2")
End With
I mean instead of using
is it better to write something likeWith myTime
If .Value >= TimeSerial(cHour, cMinute, 0) And .Value < TimeSerial(nHour, nMinute, 0) Then
so maybe i have less errors.If myTime.Value >= TimeSerial(cHour, cMinute, 0) And myTime.Value < TimeSerial(nHour, nMinute, 0) Then
Somehow my code crash...and maybe is for this kind of errors