Hello Guys,
I have a task where i want to open a input file through browse button and then copy the filtered data on the basis of product category to new file with calculation (price *Qty ) at new column and at last save the file using save as option to desired location.
I have prepared half of code but in this code as well i am getting error, so seeking expert help to complete this task. Please help us to complete this task.
Code
Option Explicit
Sub mvcheck()
Dim fd As FileDialog
Dim filechosen As Boolean
Set fd = Application.FileDialog(msoFileDialogOpen)
fd.Filters.Clear
fd.Filters.Add "2003 File", "*.xls"
fd.Filters.Add "2007 & above File", "*.xlsx"
fd.FilterIndex = 1
fd.AllowMultiSelect = False
fd.Title = "Select MV File"
''fd.Button = "Run Rec"
filechosen = fd.Show
If Not filechosen Then
MsgBox " Kindly select your file "
Exit Sub
End If
fd.Execute
Application.ScreenUpdating = False
''Workbooks(filechosen).Sheet1.Activate
With Workbooks(filechosen).Worksheets("Sheet1")
.Range("$A:$D").AutoFilter
.Range("$A:$D").AutoFilter field:=3, Criteria1:="Loan"
Range("A1").CurrentRegion.Copy
Workbooks.Add
Worksheets(1).Activate
Range("A1").PasteSpecial
With Intersect(ActiveSheet.UsedRange.EntireRow, Range("E:E"))
.FormulaR1C1 = "=RC[-1]*RC[-3]"
.Value = .Value
Range("e1").Value = "Result"
End With
End With
End Sub
Bookmarks