montecarlo2012

Well-known Member
Joined
Jan 26, 2011
Messages
984
Office Version
  1. 2010
Platform
  1. Windows
Hello Everybody. PLEASE, I have two sheets and one dynamic array in each one, what I need is to subtract row by row one from another.
On sheet 1 my array is for example purpose A1:F30, and on sheet 2 B2:G30 [in my workbook each are 6 by 2521 and growing].
this is the macro for better understanding purpose:
Code:
Sub Macro1()
    Range("H1").Select
    ActiveCell.FormulaR1C1 = "=RC[-7]-Sheet2!R[1]C[-6]"
    Range("H1").Select
    Selection.AutoFill Destination:=Range("H1:H23"), Type:=xlFillDefault
    Range("H1:H23").Select
    Range("I1").Select
    ActiveCell.FormulaR1C1 = "=RC[-7]-Sheet2!R[1]C[-6]"
    Range("I1").Select
    Selection.AutoFill Destination:=Range("I1:I23"), Type:=xlFillDefault
    Range("I1:I23").Select
    Range("J1").Select
    ActiveCell.FormulaR1C1 = "=RC[-7]-Sheet2!R[1]C[-6]"
    Range("J1").Select
    Selection.AutoFill Destination:=Range("J1:J23"), Type:=xlFillDefault
    Range("J1:J23").Select
End Sub
Really appreciate the time you've taken out of your schedule to help me.
 

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.
Sorry, but there are any few steps to UPLOAD my workbook here. I tried and nothing.
 
Upvote 0
Thank you PGC01 finally I resolved my problem, here you have the code.
Code:
Sub addrows()
Dim x As Long
Dim y As Long
    For x = 2 To Cells(Rows.Count, "B").End(xlUp).Row
        For y = 2 To 7
            Sheet2.Cells(x, 8 + y) = Abs(Cells(x, y) - Sheet1.Cells(x, y))
        Next y
    Next x
    
 End Sub
 
Upvote 0

Forum statistics

Threads
1,216,119
Messages
6,128,941
Members
449,480
Latest member
yesitisasport

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