El Scampio
New Member
- Joined
- Mar 27, 2009
- Messages
- 12
Hi
Running Excel 2007 on XP.
I kindly was helped in recording a Macro for a simple sort function. The Macro will work initially but after that will constantly fail.
It takes me to debugging in VBA which I have no idea about.
This is the macro:
The part that is Red and Bold is highlighted yellow on VBA so I gather that is where the problem lies.
Basically all I want the Macro to do is highlight cells: C6 to P106 and sort from largest to smallest by column P.
I have re-recorded the macro in hope it would fix it but the same issue repeats every time.
Any help would be greatly appreciated.
Thanks
Scamp
Running Excel 2007 on XP.
I kindly was helped in recording a Macro for a simple sort function. The Macro will work initially but after that will constantly fail.
It takes me to debugging in VBA which I have no idea about.
This is the macro:
Sub Sort()
'
' Sort Macro
'
'
Range("C6:P106").Select
ActiveWindow.SmallScroll Down:=-111
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add Key:=Range("P6:P106") _
, SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Sheet1").Sort
.SetRange Range("C6:P106")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
The part that is Red and Bold is highlighted yellow on VBA so I gather that is where the problem lies.
Basically all I want the Macro to do is highlight cells: C6 to P106 and sort from largest to smallest by column P.
I have re-recorded the macro in hope it would fix it but the same issue repeats every time.
Any help would be greatly appreciated.
Thanks
Scamp