Cell references in macros

JCSKirkman

New Member
Joined
Jul 23, 2010
Messages
1
Hi all.

Complete newbie at excel macro writing here so please forgive me in advance.

I am using Quickbooks (2008) to run my company's accounts. At each month end, I export my balance sheet and P&L report to Excel 2007 where I have written a macro to reformat the numbers - this involves adding and deleting certain rows. My problem lies with the formula I have written to add up certain sets of numbers. For example, last month end's report adds, say, cell H12 and H13 to give a total in H14. This month, however, the report I have exported from Quickbooks is larger so the numbers are now in cells H20 and H21 but my formula is still looking for values in H12 and H13 (where they don't exist any more).

I hope this makes sense and would be very grateful for any help.
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

James_Latimer

Active Member
Joined
Jan 20, 2009
Messages
415
Try using something like the following in your 'total' cell.

=(OFFSET(INDIRECT("A"&COUNTA(A:A)),-1,0))+(OFFSET(INDIRECT("A"&COUNTA(A:A)),-2,0))
 

Watch MrExcel Video

Forum statistics

Threads
1,132,994
Messages
5,656,286
Members
418,292
Latest member
spd87

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
Top