Home |
Search |
Today's Posts |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
i don't have access to excel just now, but try this
Private Sub CommandButton12_Click() With Worksheets("ENTITY") .Columns("C").SpecialCells(xlCellTypeBlanks).Entir eRow.Delete .Columns("D").SpecialCells(xlCellTypeBlanks).Entir eRow.Delete End With End Sub "Deen" wrote in message ... 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 sheet 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 activesheet copied to the worksheet called entity "Deen" wrote in message ... 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 worksheet name called entity. Could you please help me on this. Thanks in advance Deen |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Data Validation: Store cell address instead of value in the cell? | Excel Discussion (Misc queries) | |||
Store cell data in a variable | Excel Programming | |||
How to store custom data into Excel cell | Excel Programming | |||
Unsing names to store input from Userforms | Excel Programming | |||
Store Hidden Data in the Cell | Excel Programming |