Macro to Reset formulas in a column

HJSmith

New Member
Joined
Jul 22, 2021
Messages
2
Office Version
  1. 2013
Platform
  1. Windows
Hi all,

I'm new to VBA so trying to learn as much as I can but I'm stuck on this one.
I'm trying to create a macro that when the appropriate button is pressed, resets the formulas in a column that have been overtyped.
I can do this for a single cell, though I want to create one that performs along the lines of:
T5 = I5 - J5
T6 = I6 - J6
T7 = I7 - J7....

and so on.

Any help is vastly appreciated
Regards
H
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
77,767
Office Version
  1. 365
Platform
  1. Windows
Hi & welcome to MrExcel.
How about
VBA Code:
Sub HJSmith()
   Range("T5", Range("T" & Rows.Count).End(xlUp)).FormulaR1C1 = "=rc[-11]-rc[-10]"
End Sub
 
Solution

HJSmith

New Member
Joined
Jul 22, 2021
Messages
2
Office Version
  1. 2013
Platform
  1. Windows
Hi & welcome to MrExcel.
How about
VBA Code:
Sub HJSmith()
   Range("T5", Range("T" & Rows.Count).End(xlUp)).FormulaR1C1 = "=rc[-11]-rc[-10]"
End Sub
Thank you for the welcome and the prompt reply.
That worked perfectly, thank you! :)
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
77,767
Office Version
  1. 365
Platform
  1. Windows
Glad to help & thanks for the feedback.
 

Forum statistics

Threads
1,176,256
Messages
5,902,182
Members
434,945
Latest member
ngabrieln

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