VBA: Sum Across Range with Missings

jcauteru

New Member
Joined
Jul 27, 2010
Messages
15
Hi all,

I have the following code to sum across a specific range:

Code:
 total_sum = Application.WorksheetFunction.Sum(Range(Cells(row_num, start_col), Cells(row_num, end_col)))

As you can see, this line is trying to take the sum of a single row of cells, from start_col to end_col. Problem is, it errors out when trying to sum up a row with any blank cells.

Any thoughts or ideas? Any help is much appreciated!

Best,
Joe
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Blank cells within the range should not generate an error? Which error are you getting? What values do each of the variables holds when executing that line of code?
 
Upvote 0
Yea, it was actually a really simple problem. There where some "do while <> "" " loops going on and an analyst decided to change a column number to the wrong column, which had blanks.

Thanks for your input!

- Joe
 
Upvote 0

Forum statistics

Threads
1,224,560
Messages
6,179,520
Members
452,921
Latest member
BBQKING

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top