![]() |
using Subtotals in XL-VBA
I have created a Macro which picks up data from two seperate Access databases
and populates the XL sheets. One of the function of this macro is to pull data from an Access database and apply subtotals onto to the sheet. Now this works perfectly fine till the time the information pulled is not blank. Now suppose the data pulled has zero records, the Macro stops since there are nothing to be subtotalled. How do I fix this. ? |
using Subtotals in XL-VBA
Check to see what's in the range before you try the subtotal code.
dim myRng as range with worksheets("sheet1") set myrng = .range("a1:e" & .cells(.rows.count,"A").end(xlup).row) end with if myrng.rows.count = 1 then msgbox "just headers--no data" else 'keep going with your code end if I used column A to find out the last used row in that range. Venky wrote: I have created a Macro which picks up data from two seperate Access databases and populates the XL sheets. One of the function of this macro is to pull data from an Access database and apply subtotals onto to the sheet. Now this works perfectly fine till the time the information pulled is not blank. Now suppose the data pulled has zero records, the Macro stops since there are nothing to be subtotalled. How do I fix this. ? -- Dave Peterson |
All times are GMT +1. The time now is 12:02 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com