Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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. ?






  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default 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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Subtotals problem: Excel 2003 (not, AFAIK, the nested subtotals bug) AndyCotgreave Excel Discussion (Misc queries) 3 October 24th 07 11:32 AM
Original subtotals should not be within nested subtotals in excel Mirage Excel Worksheet Functions 1 June 6th 07 01:37 AM
How do I copy an outline w/ subtotals & paste just the subtotals av Excel Discussion (Misc queries) 1 June 20th 05 11:35 PM
Problem with nested subtotals, placing secondary subtotals BELOW . Dawn Cameron Excel Discussion (Misc queries) 1 June 3rd 05 10:13 PM
why are nested subtotals coming out below outer subtotals? Hendy Excel Worksheet Functions 2 January 18th 05 08:09 PM


All times are GMT +1. The time now is 03:23 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"