June 1, 2018
Hello, I have a recorded macro worksheet created by someone else, and I am trying to understand the sort steps/actions seen as below. (part of macro)
There is a full list sheet containing all the information, e.g. emails, address, etc, recorded macro segment them to a new tab in the same workbook. The person recorded it also has a worksheet "full list trimmed" in a tab (every cell =trim('full list'!), I can't find this sheet in the recorded macro, not sure why it is created?
Sheets("Emails").Select
Cells.Select
Application.CutCopyMode = False
ActiveWorkbook.Worksheets("Emails").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Emails").Sort.SortFields.Add Key:=Range( _
"S2:S20000"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Emails").Sort
.SetRange Range("A1:AF20000")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Can anyone help me with it? many thanks!
Power Query
Power Pivot
Xtreme Pivot Tables
Excel for Decision Making
Excel for Finance
Excel Analysis Toolpak
Power BI
Excel
Word
Outlook
Excel Expert
Excel Customer Service
November 8, 2013
Hi Tina,
When this macro was recorded, a sort was the only action applied to Emails sheet. Most probably, the other sheet has TRIM formulas, but these formulas were added before recording a macro, that's why it's not in the recorded macro, obviously only actions executed after you start the recorder are recorded.
You can try that yourself, start recorder, add a formula to a cell then copy it to the right and down, you'll see how the recorded macro looks.
1 Guest(s)