Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Below function can return non-holiday date, I want to return how many
holiday found. Variable HolidayResult to be update as long integer. But , I try can not able to return the non-holiday by coding HolidayResult.Address.Value = cntHoliday HolidayResult. Address is "$F$4' in my test case. Holiday Sheet format Column A - Date value Column B - Yes = Holiday, No = Non-Holiday Function xHoliday(HolidayResult As Range, loDate As Date, ByVal loOffset As Long) As Date '~~ if input value no changed, this function will not call. Dim HolidaySheet As Variant Dim i As Long Dim found As Boolean Dim cntHoliday As Long cntHoliday = 0 found = False xHoliday = loDate - loOffset Set HolidaySheet = Sheets("Holiday") i = 1001 Do If HolidaySheet.Range("A" & i) = xHoliday Then found = True Else i = i - 1 End If Loop Until found = True '~~ When return date still holiday, skip it , until Holiday = "no" found = False Do If Trim(UCase(HolidaySheet.Range("B" & i))) = "NO" Then found = True Else xHoliday = xHoliday - 1 cntHoliday = cntHoliday + 1 i = i - 1 End If Loop Until found = True ' MsgBox HolidayResult.Address HolidayResult.Address.Value = cntHoliday End Function |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how do I get the if function to return a blank cell, not 0? | Charts and Charting in Excel | |||
How to make a function in a cell update | Excel Discussion (Misc queries) | |||
A function to return the value of a blank cell | Excel Worksheet Functions | |||
function CELL() to return the formula in the referenced cell | Excel Worksheet Functions | |||
How do I use a function to return the address of a cell? | Excel Worksheet Functions |