["VBA"] subtracting the same value

montecarlo2012

Well-known Member
Joined
Jan 26, 2011
Messages
984
Office Version
  1. 2010
Platform
  1. Windows
Hi, so far this little code work, but when I tried to used with ABS[....] then whatever I did, is not working
VBA Code:
Sub d()
[AB2:AB8909] = [B2:B8909 -AB1]
[AC2:AC8909] = [C2:C8909 - AC1]
[AD2:AD8909] = [D2:D8909 - AD1]
[AE2:AE8909] = [E2:E8909 - AE1]
[AF2:AF8909] = [F2:F8909 - AF1]
End Sub
Please if you can show me a loop for this would be good, and I am looking for the absolute value.
thanks.
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
VBA Code:
Sub t()
Dim i As Long, j As Long
    For i = 28 To 32
        For j = 2 To 8909
            Cells(j, i) = Abs(Cells(i - 26, j).Value - Cells(1, i).Value)
        Next
    Next
End Sub
 
Upvote 0
Thank you Mr. FormR, and yes Sir, work for me, I really appreciate the time you spend for me.
 
Upvote 0

Forum statistics

Threads
1,214,951
Messages
6,122,442
Members
449,083
Latest member
Ava19

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