Pasting a formula automatically accross sheets and then copying result

farmertml

Board Regular
Joined
Jun 16, 2005
Messages
62
Hi Guys,

I have a workbook with multiple sheets, What I want to achieve is to adapt this macro which I'm currently using which copies a range of data from each sheet to also paste a formula into each sheet and then include the answer the formula gives in the copying process.

---------------------------------------------------------------
Code:
Dim i As Integer
Dim wsname As String

For i = 2 To ThisWorkbook.Sheets.Count

Sheets(i).Select
wsname = Sheets(i).Name
Range("D950:F950,H950").Copy
Sheets(1).Select
Range("C5").Select

If ActiveCell.Value <> "" Then

If ActiveCell.Offset(1, 0).Value <> "" Then

ActiveCell.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste

Else

ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste

End If

Else

ActiveSheet.Paste

End If
ActiveCell.Offset(0, -1).Value = wsname

Next i

---------------------------------------------------------

I want to paste the following formula into each sheet in cell G:950 and then copy the answer along with the other cells (D:950, E:950, F:950 & H:950)which would change the range to copy afterwards to 'D950:H950'

---------------------------------------------------------

Code:
=INDEX(G4:G947,MATCH(LARGE(Array2,1),Array2,0))

---------------------------------------------------------
If someone has any ideas that would be fantastic thank you!
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

Forum statistics

Threads
1,214,943
Messages
6,122,380
Members
449,080
Latest member
Armadillos

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