Hi,
Thank you so much . This works fine. But it takes more time. In my case I have about 9000 rows to get deleted. It takes about 3-4 minutes. Is there anyway I can make the time shorter , in other word faster ?
Thank you. Manuel
Hi,
The macro code you sent works fine.Thank you so much.As told earlier it takes 3-4 minutes. Is there anyway to make it faster ? I have recorded another macro in this workbook. I use that macro now. I need to run the macro you sent me ,after the macro i have given below is run. I don't know how to join these two. Can you help me ?
I have given the code below.
Sub LOAD_Click()
'
' LOAD_Click Macro
'
'
Sheets("DATA").Select
Sheets("FILE").Select
Columns("A:BG").Select
Selection.ClearContents
With ActiveSheet.QueryTables.Add(Connection:="TEXT;C:\DEPOSIT.txt", _
Destination:=Range("A1"))
.Name = "DEPOSIT"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = xlWindows
.TextFileStartRow = 1
.TextFileParseType = xlFixedWidth
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, _
1, 1, 1, 1)
.TextFileFixedColumnWidths = Array(9, 11, 22, 60, 8, 10, 11, 102, 8, 2, 3, 7, 253, 30, 36 _
, 14, 22, 40, 40, 40, 46, 14, 11, 12)
.Refresh BackgroundQuery:=False
End With
Rows("1:1").Select
Selection.Delete Shift:=xlUp
Columns("B:B").Select
Selection.Cut
Range("A1").Select
ActiveSheet.Paste
Columns("D:D").Select
Selection.Cut
Range("B1").Select
ActiveSheet.Paste
Columns("E:E").Select
Selection.Cut
Range("C1").Select
ActiveSheet.Paste
Columns("G:G").Select
Selection.Cut
Range("D1").Select
ActiveSheet.Paste
Columns("I:I").Select
Selection.Cut
Range("E1").Select
ActiveSheet.Paste
Columns("K:K").Select
Selection.Cut
Range("F1").Select
ActiveSheet.Paste
Columns("N:N").Select
Selection.Cut
Range("G1").Select
ActiveSheet.Paste
Columns("P:P").Select
Selection.Cut
Range("H1").Select
ActiveSheet.Paste
Columns("R:R").Select
Selection.Cut
Range("I1").Select
ActiveSheet.Paste
Columns("S:S").Select
Selection.Cut
Range("J1").Select
ActiveSheet.Paste
Columns("T:T").Select
Selection.Cut
Range("K1").Select
ActiveSheet.Paste
Columns("V:V").Select
Selection.Cut
Range("L1").Select
ActiveSheet.Paste
Columns("W:W").Select
Selection.Cut
Range("M1").Select
ActiveSheet.Paste
Columns("X:X").Select
Selection.Cut
Range("N1").Select
ActiveSheet.Paste
Columns("O:Y").Select
Selection.ClearContents
Range("F1").Select
ActiveCell.FormulaR1C1 = _
"=IF(AND(RC[-5]="""",RC[-4]="""",RC[-3]=""""),""BLANK"",IF(AND(MID(RC[1],1,2)<>""SB"",MID(RC[1],1,2)<>""CA"",RC[-2]=0),""CLOSED"",""ACTIVE""))"
Range("F1").Select
Selection.AutoFill Destination:=Range("F1:F65536"), Type:=xlFillDefault
Columns("A:N").Select
Selection.Sort Key1:=Range("F1"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End Sub
Regards, Manuel