maclachlan
New Member
- Joined
- Dec 28, 2005
- Messages
- 32
I have been using the code that is listed below. The code works fine but the user can't save the workbook as anything but "GMAC Reconciliation2.xls or they will get an error. I need to correct this so that the code will run in whatever workbook the user saves it to. ie GMAC200602 or GMAC200603 etc. Also I want the user to be able to pick the location of the spreadsheet that is being imported. Once the code is run I want the user to be able to pick the file from the open file pop-up.
Also I don't want the file to have to be called WholesaleInventorySearch.csv to work.
Hope this makes sense.
Also I don't want the file to have to be called WholesaleInventorySearch.csv to work.
Hope this makes sense.
Code:
Private Sub CommandButton1_Click()
Workbooks.Open ("h:\WholesaleInventorySearch.csv")
Set SourceBk = Workbooks("WholesaleInventorySearch.csv").Sheets("WholesaleInventorySearch")
Set DestinBk = Workbooks("GMAC Reconciliation2.xls").Sheets("GMAC")
SourceBk.Range("a1:bm1000").Copy DestinBk.Range("a1")
Workbooks("WholesaleInventorySearch.csv").Close SaveChanges:=False
Sheets("GMAC").Select
Selection.AutoFilter
Selection.AutoFilter Field:=12, Criteria1:="<>0", Operator:=xlAnd
Sheets("Instructions").Select
End Sub