bobrandom123
New Member
- Joined
- Apr 19, 2012
- Messages
- 11
I created a macro utilizing Excel 2007 in order to automate the process of using the TRIM function in column S to trim strings found in Column H and then AutoFill the entire column:
I am new to programming and I want to use macros in order to parse my data faster at work. Since the amount of data varies from sheet to sheet, how can I programatically get the range to go to the last row in the worksheet instead of it going to 65536?
Code:
Sub TrimFileName()
Range("S2").Select
ActiveCell.FormulaR1C1 = "=TRIM(MID(RC[-11],24,25))"
Range("S2").Select
Selection.AutoFill Destination:=Range("S2:S65536")
Columns("S:S").EntireColumn.Autofit
End Sub
I am new to programming and I want to use macros in order to parse my data faster at work. Since the amount of data varies from sheet to sheet, how can I programatically get the range to go to the last row in the worksheet instead of it going to 65536?