vzachin
11-10-2006, 08:58 PM
Hi,
I have data that is imported into Excel beginning in A5 and down. The data that is imported has a leading space which I remove with the following code:
Sheets("Sheet1").Select
Range("A5:A5").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Replace What:=" ", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Range("A5").Select
If the imported data exceeds row 65536, then the data is entered in every 4 columns up to Column IO. (A5,E5,I5...IO5)
How can I re-write the above code to work if there is any subsequent data after A5? That is to remove the leading space if there is data in the subsequent columns.
thanks
zach
I have data that is imported into Excel beginning in A5 and down. The data that is imported has a leading space which I remove with the following code:
Sheets("Sheet1").Select
Range("A5:A5").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Replace What:=" ", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Range("A5").Select
If the imported data exceeds row 65536, then the data is entered in every 4 columns up to Column IO. (A5,E5,I5...IO5)
How can I re-write the above code to work if there is any subsequent data after A5? That is to remove the leading space if there is data in the subsequent columns.
thanks
zach