Hello
I have 12 sheets (1 for each month). I use them to record my pay/hrs for each month. We receive an advance on the 15th of each month. In cell A9 on each sheet I have the name of the month.
I am trying to test to see first of all if the current month is the same as the month in cell A9 (no problem), but I also have test to see if the current day is >=15. If it is, then I do a vlookup on the sheet (and use the function created) to put the advance amount in the cell.
Ex:
<code>
Function tstcurmonth(curmonth As String)
Dim LValue As String
Dim x As Date
L = mymonth(curmonth)
x = Date
LValue = MonthName(L, False)
If LValue = ActiveSheet.Range("A9") Then
tstcurmonth = True
Else
tstcurmonth=false
End If
End Function
</code>
This much of the function works fine, but as you can see, I have not tested for the current day (>=15). If both conditions are met, then the function returns true, otherwise it returns false.
In my sheet, I would use it something like this:
<code>
=If(tstcurmonth(A9)=true,vlookup(L17,ADV,2),0)
</code>
Thank you
Terry
I have 12 sheets (1 for each month). I use them to record my pay/hrs for each month. We receive an advance on the 15th of each month. In cell A9 on each sheet I have the name of the month.
I am trying to test to see first of all if the current month is the same as the month in cell A9 (no problem), but I also have test to see if the current day is >=15. If it is, then I do a vlookup on the sheet (and use the function created) to put the advance amount in the cell.
Ex:
<code>
Function tstcurmonth(curmonth As String)
Dim LValue As String
Dim x As Date
L = mymonth(curmonth)
x = Date
LValue = MonthName(L, False)
If LValue = ActiveSheet.Range("A9") Then
tstcurmonth = True
Else
tstcurmonth=false
End If
End Function
</code>
This much of the function works fine, but as you can see, I have not tested for the current day (>=15). If both conditions are met, then the function returns true, otherwise it returns false.
In my sheet, I would use it something like this:
<code>
=If(tstcurmonth(A9)=true,vlookup(L17,ADV,2),0)
</code>
Thank you
Terry