Thanks for the response!
I receive the error on line 32: If IsNumeric(Range("N5")) Then
This code runs in a Word document, and is intended to facilitate the document being used for mail merge purposes. The existing VBA pulls data from an Excel document, which is essentially a listing of examinees’ test scores, their post-appeal scores (per appellant), and their scores adjusted for questions that were "thrown out". The Excel workbook also has various sheets, but the Word document should pull specifically from Excel sheet "Appeal 1".
In Appeal 1, I list the appellants’ pre-appeal score in column 12. In column 13, I list the appellant's score adjusted by the number of questions he or she successfully appealed ("pre-final score"). In column 14, I list the appellant's pre-final score adjusted by credit that the examiners have given to everyone who took the exam ("post universal credit score", or “final score”). This would occur in such a scenario when, for example, the examiners threw out an exam question, or have determined that every list answer choice to a particular question was correct.
The mail merge document should inform the individual of his or her final score.
When the examiners have not granted universal credit to anyone, column 14 contains text “No UC granted” (this is automated by formula). When the examiners have granted universal credit, column 14 changes to contain the individual’s score adjusted by the universal credit. This is the case even if the appellant has not received universal credit – such as in a situation where the appellant has already gotten that particular question correct and so received credit. In such cases, the appellant’s score from column 13 appears in his or her column 14. The key point is that anytime universal credit is given, even if no one benefits, a number appears in any given cell in column 14. If no universal credit is given, then text appears in any given cell in column 14.
Hence, when we have not given any universal credit and so there is no score in column 14, the Word data source & filter should use the score from column 13 (there are always numbers in column 13):
strQuery = "SELECT * FROM `Appeal 1$` WHERE (`F13` < '75') And (`F1` IS NOT NULL)"
When we have given universal credit and so there is a score in column 14, then the Word data source & filter should use the score from column 14:
strQuery = "SELECT * FROM `Appeal 1$` WHERE (`F14` < '75') And (`F1` IS NOT NULL)"
I should also note that the Excel file is entirely automated, so each column has formulas.
I have included a drop-down menu in the Excel file that launches this Word document. For this reason, the Word document will be open (the VBA is contained in this Word file), and the Excel document will almost always be open. While users can run the Word files separately from the Excel (not launching it using the drop down), they will almost always use it from Excel.
I hope that provides good background - sorry it's so long, I just wanted to try to provide enough information. Again - thanks!!!