Help! Need to repeat macro for all rows

kaleonard08

New Member
Joined
Mar 9, 2016
Messages
8
I am very basic at macros and I need some help.
I recorded the below macro and I need it to repeat but for all the rows. This was just using the record macro button so I did not do all the coding.

A little explanation: I have a table that is a calculator. I have a project that has a range of 3,000 to 5,000 rows that I would need to input the quantity and cost into the calculator. The table is on the "quote" worksheet and has three columns (qty, cost, and resale). I need to input the qty and cost into the calculator on a separate worksheet ("unit resale calculator") which will calculate the resale. Once I have the resale from the calculator, I want to input that back into the third column (resale) on the "quote" worksheet. As mentioned earlier, I recorded the first row in a macro (see below) but I need this macro to keep repeating until all the rows are complete which is an unknown number of times. Hope this is enough information. If additional information is needed, please let me know.


Sub Calculate()
'
' Calculate Macro
'

'
Sheets("Unit Resale Calculator").Select
Range("E9").Select
ActiveCell.FormulaR1C1 = "=Quote!R[-7]C[-4]"
Range("E10").Select
ActiveCell.FormulaR1C1 = "=Quote!R[-8]C[-3]"
Range("E18").Select
Sheets("Quote").Select
Range("C2").Select
ActiveCell.FormulaR1C1 = "='Unit Resale Calculator'!R[16]C[2]"
Range("C3").Select

End Sub
 
Use some figures where you know the outcome should give you more than 2 decimals.
10 divided by five will give you four zeros but 10 divided by three will not give you any zeros.
The program is probably programmed to 2 decimals.
 
Last edited:
Upvote 0

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Forum statistics

Threads
1,223,897
Messages
6,175,271
Members
452,628
Latest member
dd2

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