Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If LstMinus.Value = -1, then
Do Until iMBizDay = LstMinus.Value is evaluated as Do Until -1 = -1 which, since it's true, will skip the entire Do...Loop structure. If you want to execute the code at least once, you could use iMBizDay = 0 Do ... Loop Until iMBizDay = LstMinus.Value In article , "jacqui" wrote: I have written the following piece of code where LstMinus can equal a value of between -10 and -1. This code works fine for every value other than where LstMinus = -1 then obviously it exits the loop. I understand where I'm going wrong with the code but I'm not sure how to fix it. Can anyone help please? Many thanks Jacqui iMBizDay = -1 dMDate = dDate - 1 Do Until iMBizDay = LstMinus.Value If WeekDay(dMDate) < 7 And WeekDay(dMDate) 1 Then iMBizDay = iMBizDay - 1 dMDate = DateAdd("d", -1, dMDate) Else dMDate = DateAdd("d", -1, dMDate) End If Loop |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
split post code (zip code) out of cell that includes full address | Excel Discussion (Misc queries) | |||
Code to conditional format all black after date specified in code? | Excel Discussion (Misc queries) | |||
Drop Down/List w/Code and Definition, only code entered when selec | Excel Worksheet Functions | |||
Convert a Number Code to a Text Code | Excel Discussion (Misc queries) | |||
copying vba code to a standard code module | Excel Discussion (Misc queries) |