I'm trying to create a macro by recording to convert a text file to excel. Its a daily text file that needs to be converted to excel for easy use. So basically they have different number of lines on a daily basis. When I recorded the macro, the line is up to 987. So macro gave me the code below:
Range("M2").Select
Selection.End(xlDown).Select
Range("M987").Select
Now my question is regarding the next day text file which only have 855 lines. So when I use the recorded macro, macro selected up to line 987 even though the current file lines is 855 only. How can i change the formula to capture only to existing number of lines.