Import data from csv with open Dialogue box

Arshmaan

New member
Joined
Oct 20, 2011
Messages
10
Reaction score
0
Points
0
Location
Pakistan
Excel Version(s)
2007, 2016
hello all..

i need some help in excel vba.. i want to import data in my excel sheet which is in 4 .csv files..

i want to do this with a command button_click command... with open dialogue box then select range where to import data. the csv file contains 5 columns and i need 4 (abcd)..

can anybody help me out?
 

Ken Puls

Administrator
Staff member
Joined
Mar 13, 2011
Messages
2,519
Reaction score
4
Points
38
Location
Nanaimo, BC, Canada
Website
www.excelguru.ca
Excel Version(s)
Excel Office 365 Insider
Yes, but we'll need more info.

Do you want to browse to locate the file?
Will you always be only importing the first 4 columns?
Where do you want to put that data? And exisiting worksheet, new worksheet...?

Give us as much info as you can on what you'd like to do.
 

Arshmaan

New member
Joined
Oct 20, 2011
Messages
10
Reaction score
0
Points
0
Location
Pakistan
Excel Version(s)
2007, 2016
Thanks for your reply Ken... yes here's the info.

yah i want to locate the file, and i need 4 column always... and i need the data in existing worksheet..

actually the data is something like that...

column A - Name, column B - MSISDN, column C - Dated, and column D - Remarks

now i want to import first 3 columns (A, B and C) then left 2 columns blank (D and E) and then import the 4th column (column D in CSV) to Column F in my worksheet.. hope you understand

thanking you
 

Ken Puls

Administrator
Staff member
Joined
Mar 13, 2011
Messages
2,519
Reaction score
4
Points
38
Location
Nanaimo, BC, Canada
Website
www.excelguru.ca
Excel Version(s)
Excel Office 365 Insider
Sorry Arshmaan, I missed your post while working on other things.

Can you start by recording a macro going through your import/copy steps, then post the code here? I'll edit the code to make it more efficient/dynamic, and put in the ability to browse to a different file.
 
Top