Re: Browse the .CSV file import data from that CSV file into maste



Hi Patrick

Its working great, I treat you. Thank you very much.

And patrick i have facing one more problem, See below in that command button
script is in userform command button, in entity *** C&D column is have any
blank cell need to delete the entire row,

But is shows the error in that line "Selection.EntireRow.Delete"

Error like : Run time error '1004'
Cannot use that command on overlapping selections.


Private Sub CommandButton12_Click()
Worksheets("ENTITY").Activate
Columns("C:D").Select
Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.EntireRow.Delete
End Sub







"Patrick Molloy" wrote:

here's the demo

on a userform
place three controls
textbox , name:= txtFileName
commandbutton, name:= btnBrowse, caption: Browse...
commandbutton, name:= btnOpen, caption:= Open

add this code:=

Option Explicit
Private Sub btnBrowse_Click()
Dim sPath As String
sPath = "C:\temp\" 'whatever you need
ChDir sPath
txtFileName = Application.GetOpenFilename("CSV Files (*.csv), *.csv)")
End Sub
Private Sub btnOpen_Click()
If txtFileName.Text = "" Then Exit Sub
If Dir(txtFileName.Text) = "" Then Exit Sub
FetchData
End Sub
Private Sub FetchData()
Dim wb As Workbook
Set wb = Workbooks.Open(txtFileName.Text)
wb.ActiveSheet.Cells.Copy ThisWorkbook.Worksheets("entity").Range("a1")
wb.Close False
End Sub


How it works...
user can either type in the full name into the text box or click the browse
button. when the browse button is clicked the full path and name of the
selected file is placed into the textbox
if the user is ok with this, press the Open button.
the csv file is opened and the active*** copied to the work*** called
entity



"Deen" <Deen@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:5B1F5A96-DC5F-42D9-A045-054825A9D16A@xxxxxxxxxxxxxxxx
Hi Patrick,

I hope you are doing well,

I have 1 more doubt, In my user form ihave the command button called
browse
the data. once i click the button need to browse windows open to search
the
.CSV once i select the particular csv file click open, Automatically data
will copy(import) and paste in to the master excel, in that work*** name
called entity.

Could you please help me on this.


Thanks in advance

Deen

.