Sorry for the delay, wasn't expecting feedback so soon.
Here is the record requested:
I also recorded an macro with the entire selection process:Code:Sub Macro1() ' ' Macro1 Macro ' ' With ActiveSheet.QueryTables.Add(Connection:= _ "TEXT;C:\Users\bszoverdffy\Desktop\New folder\dsadas.txt", Destination:=Range _ ("$A$1")) .Name = "dsadas" .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 Columns("A:A").Select Selection.Delete Shift:=xlToLeft Columns("C:C").Select Selection.Delete Shift:=xlToLeft Selection.Delete Shift:=xlToLeft Columns("E:E").Select Selection.Delete Shift:=xlToLeft ActiveWindow.ScrollColumn = 3 ActiveWindow.ScrollColumn = 2 ActiveWindow.ScrollColumn = 1 End Sub
I've also tried to get the required rows using Excel functions.Code:Sub Macro3() ' ' Macro3 Macro ' ' 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 Columns("A:A").Select Selection.Delete Shift:=xlToLeft Columns("C:C").Select Selection.Delete Shift:=xlToLeft Selection.Delete Shift:=xlToLeft Columns("E:E").Select Selection.Delete Shift:=xlToLeft ActiveWindow.ScrollColumn = 3 ActiveWindow.ScrollColumn = 2 ActiveWindow.ScrollColumn = 1 Rows("1:1").Select Rows("1:1751").Select Selection.Delete Shift:=xlUp Rows("771:789").Select Selection.Delete Shift:=xlUp End Sub
the problem with this is that for some reason vlookup only works for the highlighted part, the rest of columns/rows I get N/ACode:Sub Macro2() ' ' Macro2 Macro ' ' Selection.FormulaR1C1 = "=VLOOKUP(Sheet2!R1C1,Sheet1!C[-1]:C[2],2,0)" Range("C1").Select Selection.FormulaR1C1 = "=VLOOKUP(Sheet2!R1C1,Sheet1!C[-1]:C[2],3,0)" End Sub![]()




Reply With Quote
Bookmarks