On Dec 22, 10:35 am, PSULionRP <PSULio...@discussions.microsoft.com>
wrote:
> I have an Access module which dynamically creates an Excel spreadsheet. Now
> the Business User has asked that we put a Total Line in the Excel spreadsheet.
>
> How do I within Access VBA determine the range, because the spreadsheet will
> never be the same, and then use that range to create a formula to insert to
> the local recordset which dynamically creates the Excel spreadsheet with the
> Total Line???
>
> Thanks in advance for your review and help and hopeful for a reply.
>
> PSULionRP
If the first empty data row indicates the end of the data, combine:
http://groups.google.com/group/micro...ed3b336e50b264
with VBA code in Access something like (air code):
For lngJ = 1 To lngMaxNumberOfRowsWithData
boolContinue = False
For I = 1 To intNumberOfColumnsWithData
If objXL.Cells(I, lngJ).Value <> "" Then
boolContinue = True
Exit For 'Found some data in the row so go to the next row
End If
Next I
If boolContinue = False Then Exit For 'All data columns are empty
Next lngJ
If lngJ <> lngMaxNumberOfRowsWithData Then
MsgBox("Put the SUM formulae in row " & CStr(lngJ))
Else
MsgBox("Put the SUM formulae in row " & CStr(lngJ + 1))
End If
James A. Fortune
(E-Mail Removed)