I am Trying to count the number of columns a .txt file has using a macro. My code how ever takes for ever to run and a culprit is this code
Set wb = Workbooks.Open(FName)
Dim lastColumn As Integer
Dim rng As Range
Set rng = wb.Worksheets(1).Cells
lastColumn = rng.Find(What:="*", After:=rng.Cells(1), Lookat:=xlPart, LookIn:=xlFormulas, SearchOrder:=xlByColumns, SearchDirection:=xlPrevious, MatchCase:=False).Column
wb.Close False
Basically im opening the .txt file i think, counting them, storing it in a value, and closing it which takes forever, is there a better way to do this?