Macro Autofill

Khellian

New Member
Joined
Jul 29, 2011
Messages
5
Being new to Excel Macros I would appreciate some help in a small programming problem. I have a spreadsheet where I will be adding data on a daily basis. There is a date column with three additional columns where integers will be added, and a last column which will contain a formula that will calculate a value based on the three integers.

As each additional row will be new each day, I need to get a macro in place where by clicking on a button, the macro will find the last row in the formula column and then autofill down to the row below so that the formula is preserved and produces a result based on the new figures for that day.

I would greatly appreciate any advice. - Thanks in advance !
 
However, when I created a number of additional rows at the bottom of the table that would allow me to add data without having to increase the size of the table, I found that the formula in the empty lines showed a divide by zero error. I got round that by using conditional formatting which when an error is displayed turns the color of the text to the same as the background - hence it is invisible. Another way would be to just increase the size of the table by dragging it down a row each time I put data in.
Conditional Formatting is volatile and hence adds some overhead to your sheet. Whilst that is not likely to be a problem unless your sheet in very large, yet another way to try is to change your formulas slightly to eliminate the errors. For example (for row 2 copied down) try ..

=IFERROR(B2/E2/D2,"")
=IF(A2="","",DAYS360(A2,$K$2))

.. and remove the Conditional Formatting.
 
Last edited:
Upvote 0

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
A way around that is as follows

Then you don't need Cond Formatting and if you need to Sum Column C at the bottom you won't have any issues either.

Excel Workbook
ABCD
1ABC=B/AISERROR
201#DIV/0!
31222
42844
501#DIV/0!
6Sum:#DIV/0!6
Sheet1
Excel 2010
Cell Formulas
RangeFormula
C2=B2/A2
C3=B3/A3
C4=B4/A4
C5=B5/A5
C6=SUM(C2:C5)
D2=IF(ISERROR(B2/A2),"",B2/A2)
D3=IF(ISERROR(B3/A3),"",B3/A3)
D4=IF(ISERROR(B4/A4),"",B4/A4)
D5=IF(ISERROR(B5/A5),"",B5/A5)
D6=SUM(D2:D5)



EDIT: Hadn't seen Peter's reply yet. :)
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,754
Members
452,940
Latest member
rootytrip

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