Computing.Net > Forums > Office Software > Macro code

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Macro code

Reply to Message Icon

Name: Jeff58
Date: August 29, 2009 at 06:08:23 Pacific
OS: Windows Vista
Product: Microsoft Excel 2000/visual basic for applications fundamentals
Subcategory: Microsoft Office
Comment:

Hi all, I have a spreadsheet with rows of information separated by a blank row. The number of rows will be variable each month. I need to sum a column for each of that number of rows and copy past to another worksheet in the same workbook. My issue is that I do not know the code to sum the rows down to the blank row. Can you help me?



Sponsored Link
Ads by Google

Response Number 1
Name: Mike (by mmcconaghy)
Date: August 29, 2009 at 07:52:43 Pacific
Reply:

If I understand your question correctly, try:

=SUM(StartCell:EndCell)

=SUM(A1:A9)

Excel counts blank or empty cells as Zero.

MIKE

http://www.skeptic.com/


0

Response Number 2
Name: DerbyDad03
Date: August 29, 2009 at 11:52:38 Pacific
Reply:

If I understand your question correctly, you have blocks of data such as this:

A1:A3
A5:A10
A12:A16

Have you considering using Named Ranges?

For example, if you give A1:A3 a name, such as Group1, you can use SUM(Group1) to get your total. If you insert a row between A1 and A3, Group1 will now include that row.

As long as you don't add a row before A1 or after A3, the row will become part of the named range.

If you think you'll need to add rows at the beginning or end of the Named Range, see this site for tips on creating Dynamic Named Ranges that will change size based on the criteria used:

http://www.ozgrid.com/Excel/Dynamic...


0

Response Number 3
Name: Jeff58
Date: August 29, 2009 at 16:06:07 Pacific
Reply:

Unfortunately each range is a different cost centre and will vary each month depending on the number of jobs done. This is a table extracted from MYOB and so there is no formating. The only division between each cost centre is a blank row. I thought that I might be able to copy the name of each cost centre down and stop at the blank row but this is difficult because the number of rows changes each month. Any ideas are most welcome.


0

Response Number 4
Name: Mike (by mmcconaghy)
Date: August 29, 2009 at 16:24:01 Pacific
Reply:

You lost me.....

MIKE

http://www.skeptic.com/


0

Response Number 5
Name: Jeff58
Date: August 29, 2009 at 17:08:41 Pacific
Reply:

Sorry...
I extracted a table in MYOB which provides the profit from each job. The jobs are dated and collected under 9 cost centres. Each group is separated by a blank row. What I am trying to do is report the profitability of each cost centre by month. The only link I have is that there is a "Name" column and each group has a "Name" at the top and a "Name 1" at the bottom with a list in the middle. Next is a blank row followed by the next group "Name", a list and "Name1" and so on.
The more detail I provide the more difficult it sounds.Sorry


0

Related Posts

See More



Response Number 6
Name: DerbyDad03
Date: August 29, 2009 at 20:41:58 Pacific
Reply:

Actually, it might be better if you provided some detail related to the Name and Name1 you mentioned.

Please provide an example of 2 groups of data so we can the beginning, the list and then the end of each. There maybe something we can do with the Name column.

I know that we can use VBA to sum each group between the blank lines, but I'd like to see if a formula could be used. In any case, I'd need to see some example data befre I could offer any code.


0

Response Number 7
Name: Jeff58
Date: August 29, 2009 at 21:16:37 Pacific
Reply:

The column titled Job Number has 9 sun headings. eg DM DOM underwhich are the job numbers 1001/09, 1002/09 etc followed by DM DOM1 and then a blank row followed by CW DOM the job numbers 1012/09, 1013/09 etc followed by CW DOM1. Each job number has Net Profit and Finish Date. The outcome I am after is the Profit (Sum) of each of the headings by month. Hope this helps. J


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Office Software Forum Home


Sponsored links

Ads by Google


Results for: Macro code

Macro code changes www.computing.net/answers/office/macro-code-changes/7657.html

Word2003 produces wrong macro code www.computing.net/answers/office/word2003-produces-wrong-macro-code/4983.html

macro code error please help www.computing.net/answers/office/macro-code-error-please-help/8840.html