Insert formula in multiple excel sheets

0 votes

I am trying to insert formulas into an excel sheet with VBA but formula insert only one sheet

Sub RunSheets1()
Sheets("Sheet1").Activate
With ThisWorkSheet
   
          
                Range("B5").Formula = "=SUM(F3,G3,H3,I3,J3)"
End With

Sheets("Sheet2").Activate
With ThisWorkSheet
   
          
                Range("H6").Formula = "=SUM(F4,G4,H4,I4,J4)"
               Range("AC6").Formula = "=SUM(AC4,AD4,AE4,AF4,AG4)"
End With


Sheets("Sheet3").Activate
With ThisWorkSheet
   
          
                Range("H6").Formula = "=SUM(F4,G4,H4,I4,J4)"
               Range("AC6").Formula = "=SUM(AC4,AD4,AE4,AF4,AG4)"
End With

Sheets("Sheet4").Activate
With ThisWorkSheet
   
          
                Range("H6").Formula = "=SUM(F4,G4,H4,I4,J4)"
               Range("AC6").Formula = "=SUM(AC4,AD4,AE4,AF4,AG4)"
End With

Sheets("Sheet5").Activate
With ThisWorkSheet
   
          
                Range("H6").Formula = "=SUM(F4,G4,H4,I4,J4)"
               Range("AC6").Formula = "=SUM(AC4,AD4,AE4,AF4,AG4)"
End With




End Su
Jan 17, 2023 in Others by Kithuzzz
• 38,010 points
291 views

1 answer to this question.

0 votes

To fill across the sheets, you can use something like this:

With Sheets("Sheet2")
    .Range("H6").Formula = "=SUM(F4,G4,H4,I4,J4)"
    .Range("AC6").Formula = "=SUM(AC4,AD4,AE4,AF4,AG4)"
    Sheets(Array("Sheet2", "Sheet3", "Sheet4", "Sheet5")).FillAcrossSheets .Range("H6")
    Sheets(Array("Sheet2", "Sheet3", "Sheet4", "Sheet5")).FillAcrossSheets .Range("Ac6")
End With
answered Jan 17, 2023 by narikkadan
• 63,420 points

Related Questions In Others

0 votes
1 answer

Is there a maximum number of formula fields allowed in Excel (2010)

See http://office.microsoft.com/en-us/excel-help/excel-specifications-and-limits-HP010073849.aspx for limits on specs it doesn't indicate ...READ MORE

answered Sep 30, 2022 in Others by narikkadan
• 63,420 points
417 views
0 votes
1 answer

Moving Average formula in Excel not autofilling in table

You could use AVERAGEIFS to make the ...READ MORE

answered Oct 2, 2022 in Others by narikkadan
• 63,420 points
710 views
0 votes
1 answer

SharePoint - Excel Online - Edit in Excel and Edit in Browser multiple users

Here is the Microsoft article regarding co-authoring https://support.office.com/en-us/article/Collaborate-on-Excel-workbooks-at-the-same-time-with-co-authoring-7152aa8b-b791-414c-a3bb-3024e46fb104?ui=en-US&rs=en-US&ad=US When ...READ MORE

answered Oct 3, 2022 in Others by narikkadan
• 63,420 points
960 views
0 votes
1 answer

INDEX formula in Excel, Top 10, repeats previous value

Try this formula in cell W4: =IF(V3=V4,INDEX(INDIRECT("I"&MATCH(W3,I:I,0)+1&":I26"),MATCH(V4,INDIRECT("R"&MATCH(W3,I:I,0)+1&":R26"),0)),INDEX($I$2:$I$26,MATCH(V4,$R$2:$R$26,0))) The calculation ...READ MORE

answered Oct 8, 2022 in Others by narikkadan
• 63,420 points
624 views
0 votes
0 answers

Convert Rows to Columns with values in Excel using custom format

1 I having a Excel sheet with 1 ...READ MORE

Feb 17, 2022 in Others by Edureka
• 13,670 points
727 views
0 votes
1 answer

Remove formulas from all worksheets in Excel using VBA

Try this : Option Explicit Sub test1() ...READ MORE

answered Oct 3, 2022 in Others by narikkadan
• 63,420 points
1,465 views
0 votes
1 answer

Calculate monthly average from daily data without PivotTable

Assuming you have the months in column D enter ...READ MORE

answered Oct 3, 2022 in Others by narikkadan
• 63,420 points
1,310 views
0 votes
1 answer

Automate compound annual growth rate (CAGR) calculation

The following PowerPivot DAX formulas worked for ...READ MORE

answered Oct 7, 2022 in Others by narikkadan
• 63,420 points
1,002 views
0 votes
1 answer

How to simplify adding multiple countifs formula in excel

If the Excel version you are using ...READ MORE

answered Nov 26, 2022 in Others by narikkadan
• 63,420 points
411 views
0 votes
1 answer

Download multiple excel files linked through urls in R

Try something along the lines of: for (i ...READ MORE

answered Sep 23, 2022 in Others by narikkadan
• 63,420 points
1,018 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP