adding columns with macros

Rick DeLa

New Member
Joined
May 7, 2002
Messages
14
I have numbers on columns 02,p2, and q2 going all the way to row 40. I need to have to totals on j2. I can easily do the =sum(o2:q2) I would like this to be a macro. Problem is the next time I export data to those columns it will not always end at row 40. I need to have a formula in my macro that will sum whatever is in those 3 columns. Regardles what row it ends. And if there is no data, I would like it to be blank with no zeros

Any help I can get would be GREATLY APPRECIATED!!!
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
I'm not quite understanding you. You talk about a column and then indicate a cell ! For example Q2 is not a column it is the cell at the intersection point of columnQ and Row2.
Secondly how do you want the totals completed ... by row ?
 
Upvote 0
Maybe I'm not understanding but why not just type the formuala =O2+P2+Q2 into J2 and then drag this all the way down the column J.

As far as the zero's not showing when there is not data just goto your Tool Bar and : select "TOOLS"...."OPTOINS"...VIEW TAB.. and uncheck the "zero values" check box.
 
Upvote 0
Ok then enter =sum(O:Q) in the J2 box and drag it down the column.
If this is all you want to do I don't see there to be a need for a macro.
 
Upvote 0
That's what I did but I am creating a macro. If the data only goes to row 40 that's where the macro will stop. So the next time I load data (mor that 40 rows) the macro will only sum up to 40.
 
Upvote 0

Forum statistics

Threads
1,214,599
Messages
6,120,447
Members
448,966
Latest member
DannyC96

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