Applying a macro on an open CSV file

angelo328

New Member
Joined
Sep 21, 2010
Messages
9
Dear all
Having received help already so please could some one indulge me one last time.
I have Workbook A in which I have a series of macros that will cleanse a downloaded CSV file from my bank that I have imported into my main spreadsheet. However I would prefer to run the macro without importing the CSV file.
How can I achieve this?
To reiterate I have a Main workbook let's call it Workbook A and another downloaded csv file called TransHist.csv. Workbook A contains all the necessary macros.

Thank you in Advance

Angelo
 
Last edited:

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
i could be wrong, but i've never heard of csv being manipulated from excel.

you could automate an import, manipulation and subsequent saving from a stored bas file
 
Upvote 0
i could be wrong, but i've never heard of csv being manipulated from excel.

you could automate an import, manipulation and subsequent saving from a stored bas file

Thank you for responding Mole999.
This may explain why I couldn't get my code to work. I therefore saved the file as an xlsx file and was succesful.
You will see from my code (cannibalised from another post) that I used the "open" command. What would be the code for a file that is already opened? This is to save picking up an older file in error. I will look into importing the csv file though finding suitable code takes me ages as I am not to clever in creating it myself.

Code:
Sub Button()
'Opens and applies macros
Dim ThisWkbkNm As String
ThisWkbkNm = ActiveWorkbook.Name

'Open/Close "WorkbookA.xls"
Workbooks.Open Filename:="C:\DOWNLOADS\TransHist.xlsx"
Application.Run "'HSBC'!Main"
On Error Resume Next

Workbooks(ThisWkbkNm).Activate                             'Reactivate this workbook

End Sub
 
Last edited by a moderator:
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,263
Members
452,627
Latest member
KitkatToby

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top