excel - User Open CSV Into Tab Using VBA -


i trying button when pressed prompts user open csv file , bunch of other things automatically performed on csv file. here code working with:

sub mainmacro()  dim fnameandpath variant fnameandpath = application.getopenfilename(filefilter:="excel files (*.csv), *.csv", title:="select file opened") if fnameandpath = false exit sub workbooks.open filename:=fnameandpath  'sheets.add after:=sheets(sheets.count)  'activesheet.name = fnameandpath  call macro1 call macro2 call macro3 call macro4 end sub 

put opens csv file , want open in tab , marco1 marco2... can perform respective tasks. button perform of mainmacro() on newly active sheet user loaded in.

this code open csv , copy worksheet original workbook will. on copying sheet destination workbook, copied sheet activate.

sub mainmacro()     dim csvwb workbook     dim fnameandpath variant     fnameandpath = application.getopenfilename(filefilter:="excel files (*.csv), *.csv", title:="select file opened")     if fnameandpath = false exit sub     set csvwb = workbooks.open(filename:=fnameandpath)     csvwb.worksheets(1).copy before:=thisworkbook.worksheets(1)     csvwb.close     call macro1     call macro2     call macro3     call macro4 end sub 

of course, depending on macro1-4 do, may easier open in different workbook , perform macros against that?


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -