Hi
You can use this code to import the text file. Not sure about the formula. In which range you want the formula ?
Code:Sub Macro3() Dim nm As Name For Each nm In ThisWorkbook.Names If nm.Name Like "dsadas*" Then nm.Delete Next With ActiveSheet.QueryTables.Add(Connection:= _ "TEXT;C:\Users\bszoverdffy\Desktop\New folder\dsadas.txt", Destination:=Range _ ("$A$1")) .Name = "dsadas_1" .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .RefreshStyle = xlInsertDeleteCells .SavePassword = False .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .TextFilePromptOnRefresh = False .TextFilePlatform = 65001 .TextFileStartRow = 1 .TextFileParseType = xlDelimited .TextFileTextQualifier = xlTextQualifierDoubleQuote .TextFileConsecutiveDelimiter = False .TextFileTabDelimiter = True .TextFileSemicolonDelimiter = False .TextFileCommaDelimiter = False .TextFileSpaceDelimiter = False .TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1) .TextFileTrailingMinusNumbers = True .Refresh BackgroundQuery:=False End With Range("b:b,c:c,f:g").EntireColumn.Delete Rows("1:1751").Delete Shift:=xlUp Rows("771:789").Delete Shift:=xlUp End Sub




Reply With Quote
Bookmarks