Hi,
I need help with the vba code below. The code works but only on the current worksheet that I select. It won't loop through all the remaining worksheets in my workbook? I do NOT have a problem with the formulas. I want the formulas (Date and Sumif) to be copied to the other worksheets (currently 50) excluding the 9 mentioned below. I have tried to search the forum but can't seem to find a solution. The exact number of worksheets in my workbooks will vary each month.
I am new to vba. The code below was piecemeal-ed from some other code that I have founded to work but I inserted my new formulas in there instead of the original formula.
Could someone please let me know how to get my formulas copied to the other worksheets? Thank you in advance for your time and assistance.
Sub Macro2()
je = "JE"
qsumttm = "QSumTTM"
dttm = "DetailTTM"
qsum = "QSum"
d = "Detail"
wttm = "WalTTM"
w = "Wal"
staff = "Stafflisting"
Sum = "Summary"
Application.Calculation = xlCalculationManual
Dim Sht As Worksheet
For Each Sht In ActiveWorkbook.Sheets
With Sht
If Sht.Name <> je And Sht.Name <> qsumttm And Sht.Name <> dttm And Sht.Name <> qsum And Sht.Name <> d And Sht.Name <> wttm And Sht.Name <> w And Sht.Name <> staff And Sht.Name <> Sum Then
Range("S10").Select
ActiveCell.FormulaR1C1 = "=DATE(YEAR(RC[-3]),1,1)"
Range("S11").Select
ActiveCell.FormulaR1C1 = "=SUMIF(R10C5:R10C16,"">=""&R10C19,RC[-14]:RC[-3])"
Selection.AutoFill Destination:=Range("S11:S135"), Type:=xlFillDefault
End If
End With
Next Sht
Application.Calculation = xlCalculationAutomatic
End Sub
I need help with the vba code below. The code works but only on the current worksheet that I select. It won't loop through all the remaining worksheets in my workbook? I do NOT have a problem with the formulas. I want the formulas (Date and Sumif) to be copied to the other worksheets (currently 50) excluding the 9 mentioned below. I have tried to search the forum but can't seem to find a solution. The exact number of worksheets in my workbooks will vary each month.
I am new to vba. The code below was piecemeal-ed from some other code that I have founded to work but I inserted my new formulas in there instead of the original formula.
Could someone please let me know how to get my formulas copied to the other worksheets? Thank you in advance for your time and assistance.
Sub Macro2()
je = "JE"
qsumttm = "QSumTTM"
dttm = "DetailTTM"
qsum = "QSum"
d = "Detail"
wttm = "WalTTM"
w = "Wal"
staff = "Stafflisting"
Sum = "Summary"
Application.Calculation = xlCalculationManual
Dim Sht As Worksheet
For Each Sht In ActiveWorkbook.Sheets
With Sht
If Sht.Name <> je And Sht.Name <> qsumttm And Sht.Name <> dttm And Sht.Name <> qsum And Sht.Name <> d And Sht.Name <> wttm And Sht.Name <> w And Sht.Name <> staff And Sht.Name <> Sum Then
Range("S10").Select
ActiveCell.FormulaR1C1 = "=DATE(YEAR(RC[-3]),1,1)"
Range("S11").Select
ActiveCell.FormulaR1C1 = "=SUMIF(R10C5:R10C16,"">=""&R10C19,RC[-14]:RC[-3])"
Selection.AutoFill Destination:=Range("S11:S135"), Type:=xlFillDefault
End If
End With
Next Sht
Application.Calculation = xlCalculationAutomatic
End Sub