VBA to SUM only certain cells

J

James

I have no clue on this one or how to even start it. I have a spreadsheet
with data in a row, the data starts at G2 and goes until AS2. I want to
"SUM" this data but the complicated part comes now.... In some cases I want
to to SUM G2 thru S2, or AA2 thru AN2, or even G2 thru AS2. The results
would need to be placed in AU2.

I really dont have a set of standards that I SUM, it is all dependent on
what values I have in these cells and what I plan on doing with them that
day. Is it possible to write a code that allows the user to pick the cells
they want to sum, such as dragging over the cells needed?

Thanks again for the help.
 
S

SheriTingle

Until you get a VBA option there is a manual way to do it. Type =sum( then
select the first cell or range in the equation, hold down the Ctrl key on
your keyboard and continue to click individual cells or ranges. Don't let go
of Ctrl until you are finished with your selection. Type ) and hit the enter
key. This will create a SUM function with the cells you would like to add.
Here's an example of how it may look:

=SUM(A3:C5,D6:E11,B15:E16,H3,I8,G10:G15)

Good luck.
 
J

James

That is what I do now, but I am trying to automate this spreadsheet as much
as possible and trying to push all the calculations through code to eliminate
errors.

Thank you though
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top