I have a vba code in ASSETS CALC workbook for selecting another workbook (ASSETS) through a user form. The code inserts a specific row in ASSETS, filters data, adds it together, and then copies the final number over to ASSETS CALC. Unfortunately, for some reason, the row that is inserted into the ASSETS workbook is also insterted into the ASSETS CALC workbook and filters are added. Does anyone know how to stop this? I just want the final number to be copied over to ASSET CALC.
Thank you.
Dim str1 As String
Dim i As Integer
Application.ScreenUpdating = False
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) = True Then
str1 = ListBox1.List(i)
End If
Next i
Workbooks(str1).Activate
Sheets(1).Activate
Rows("4:4").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Selection.AutoFilter
ActiveSheet.Range("$A$4:$C$22").AutoFilter Field:=1, Criteria1:="=it*", _
Operator:=xlAnd
ActiveSheet.Range("$A$4:$C$22").AutoFilter Field:=2, Criteria1:="cash"
Range("C28").Select
ActiveCell.FormulaR1C1 = "=SUBTOTAL(9,R[-11]C:R[-7]C)"
Range("C28").Select
Windows("Asset Calc..xlsm").Activate
Range("D11").Select
ActiveCell.FormulaR1C1 = "=[" & str1 & "]Sheet1!R28C3"
Range("D12").Select