excelnoob12345
New Member
- Joined
- Nov 20, 2020
- Messages
- 1
- Office Version
- 2013
- Platform
- Windows
Hi all,
I have a code that I would like to apply to multiple worksheets. Basically I am trying to use advanced filter which draws data from Sheets("CopyPaste") and the criteria and output is into all of the different multiple sheets.
This code only works if I click on each sheet to activate it and run the Macro. I have to do this one-by-one. I want this to be applied to multiple worksheets without having to activate and click anything.
Sub HELPPlease()
Sheets("CopyPaste").Range("A4:BD9001").AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Range("A1:A2"), CopyToRange:=Range("A5:J5"), Unique:=False
Dim strFormulas(1 To 3) As Variant
With ActiveSheet
strFormulas(1) = "=I6/F6*100000"
strFormulas(2) = "=VLOOKUP(D6,ISIN!$A$3:$C$370,3,FALSE)"
strFormulas(3) = "=L6-K6"
.Range("K6:M6").Formula = strFormulas
Dim LastPopulatedRow As Long
'Find last populated row
LastPopulatedRow = Range("A" & Rows.Count).End(xlUp).Row
'Select the rows where formula is to be populated
Range("K6: " & "M" & LastPopulatedRow).FillDown
End With
End Sub
Any help is greatly appreciated! Thank you
I have a code that I would like to apply to multiple worksheets. Basically I am trying to use advanced filter which draws data from Sheets("CopyPaste") and the criteria and output is into all of the different multiple sheets.
This code only works if I click on each sheet to activate it and run the Macro. I have to do this one-by-one. I want this to be applied to multiple worksheets without having to activate and click anything.
Sub HELPPlease()
Sheets("CopyPaste").Range("A4:BD9001").AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Range("A1:A2"), CopyToRange:=Range("A5:J5"), Unique:=False
Dim strFormulas(1 To 3) As Variant
With ActiveSheet
strFormulas(1) = "=I6/F6*100000"
strFormulas(2) = "=VLOOKUP(D6,ISIN!$A$3:$C$370,3,FALSE)"
strFormulas(3) = "=L6-K6"
.Range("K6:M6").Formula = strFormulas
Dim LastPopulatedRow As Long
'Find last populated row
LastPopulatedRow = Range("A" & Rows.Count).End(xlUp).Row
'Select the rows where formula is to be populated
Range("K6: " & "M" & LastPopulatedRow).FillDown
End With
End Sub
Any help is greatly appreciated! Thank you