VBA Loop in Excel wont recognize time -
i creating spreadsheet allow users copy events during specific 15 minute interval specific sheet in workbook. time intervals run midnight 23:45. code works fine copying happened @ or before 6:45 after comes blank. have manually checked data , there events on primary sheet happen after 6:45 , should copied over. data being pulled same oracle table time formats should same.
here piece of code works:
'core - orange 06:45 if activecell.address = "$ac$6" if range("ac6").value = 0 msgbox "no exceptions reported" else: sheets("exceptions").range("a4", "h50").clear sheets("core").select = 2 x = 4 while sheets("core").range("a" & i).value <> "" if range("j" & i).value <= timeserial(6, 45, 0) , range("k" & i).value > timeserial(6, 45, 0) range("a" & i, "h" & i).select selection.copy sheets("exceptions").select range("a" & x).select activesheet.paste = + 1 x = x + 1 sheets("core").select else: sheets("exceptions").select range("a1").select = + 1 end if loop end if end if
here code not working:
'core - orange 07:00 if activecell.address = "$ad$6" if range("ad6").value = 0 msgbox "no exceptions reported" else: sheets("exceptions").range("a4", "h50").clear sheets("core").select = 2 x = 4 while sheets("core").range("a" & i).value <> "" if range("j" & i).value <= timeserial(7, 0, 0) , range("k" & i).value > timeserial(7, 0, 0) range("a" & i, "h" & i).select selection.copy sheets("exceptions").select range("a" & x).select activesheet.paste = + 1 x = x + 1 sheets("core").select else: sheets("exceptions").select range("a1").select = + 1 end if loop end if end if
the 2 codes should identical except initial cells updated. have tried using different time formats nothing seemed work. or suggestions on how past appreciated.
Comments
Post a Comment