Thank you for you friendly and helpful reply NOT! A little toleration in your response would have been nice.
What do you mean by
Moved from Excel Formulas & Functions
? Where has it been moved to or has it been removed altogether?
I had major problems navigating the rather convoluted process of entering code and attaching the example file and made a number of attempts at posting my update; losing my content several times. I even posted a query with the webmaster. The forum format and navigation, not to mention some moderators, is not very friendly to occasional users.
The final post was made by accident and I was so relieved at getting something to stick that actually had retained the attached file that I failed to notice that the code was not enclosed by code tags. Here it is again, enclosed by tags:
Function FindReceiptDate(CurrReceiptDate As Integer)
'This function sets up the entries for the receipts on each worksheet by:
'1) Checking for five Fridays in the active workksheet.
'2) Checking for the presence of a receipt in the active worksheet.
'3) If the worksheet is Apr then uses a seed date obtained manually from the last receipt from the workbook for the previous year (Mar).
'4) For subsequent worksheets it finds the date (day only as an integer) of the (last) receipt for the previous month.
'5) It then adds 28 days to obtain the receipt date for the current worksheet.
'6) If the date is less than 28 days before the end of the month it finds the date of a second receipt for the current month.
'7) It finally populates the rest of the record.
'A future development may be the automatic population of receipts on every sheet.
Const Receipt = "Receipt"
Dim CurrSheetNumber As Integer
Dim PrevSheetNumber As Integer
'Dim CurrReceiptDate As Integer
Dim PrevReceiptDate As Integer
Dim SecondReceiptDate As Integer
Dim CurrDays As Integer
Dim PrevDays As Integer
CurrSheetNumber = ActiveSheet.Index
PrevSheetNumber = ActiveSheet.Index - 1
PrevDays = Day(Application.WorksheetFunction.EoMonth(Range("$B$4"), -1)) 'Days in previous month
CurrDays = Day(Application.WorksheetFunction.EoMonth(Range("$B$4"), 0)) 'Days in current month
'1) Find the date of the AA receipt for the current month based on teh receipt date of the previous month (+28 days).
'2) Check to see if there are two payment in the current month.
If PrevSheetNumber <> 0 Then
Worksheets(PrevSheetNumber).Select
Range("F5:F49").Find(Receipt).Select
PrevReceiptDate = Cells(ActiveCell.Row, 3)
CurrReceiptDate = PrevReceiptDate + 28 - PrevDays
Worksheets(CurrSheetNumber).Select
' MsgBox "AA Receipt date this month = " & CurrAAReceiptDate
' If CurrAAReceiptDate + 28 <= CurrDays Then
' SecondAAReceiptDate = CurrAAReceiptDate + 28
' MsgBox SecondAAReceiptDate
' End If
End If
FindFirstEmptycel = CurrReceiptDate
'Range(ActiveCell).value = CurrAAReceiptDate
'MsgBox (ActiveSheet.Name)
'MsgBox ("Days last month=" & PrevDays & " Days this month = " & CurrDays)
'MsgBox "AA Receipt date last month = " & PrevAAReceiptDate
End Function
Edit
Further inspection suggests that I had enclosed the code in code tags. In this post, in which the code definitely was enclosed in tags, the code is displayed in a panel with a grey background and with a "Copy to clipboard" icon identical to my previous post. On what have you based your criticism?
Bookmarks