ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,738
- Office Version
- 2007
- Platform
- Windows
Evening,
I thought i new what i was doing but ......
I have a range on one sheet as follows C1:F13 "split into 4 columns"
C = name D = total sold "C1:D13"
E = name F = total sold "E1:F13"
Clicking on a button would copy info from range above "C1:D13" & "E1:F13" then sort from popular to least popular on another sheet in the range C1:D26
I need to sort these items BUT on the same sheet now.
Basically the range of names / items sold just need to be sorted in the same range each time my button is pressed.
If any help to you the existing working code is shown below,"this copies from one sheet & sorts & thes pastes on another sheet"
I thought i new what i was doing but ......
I have a range on one sheet as follows C1:F13 "split into 4 columns"
C = name D = total sold "C1:D13"
E = name F = total sold "E1:F13"
Clicking on a button would copy info from range above "C1:D13" & "E1:F13" then sort from popular to least popular on another sheet in the range C1:D26
I need to sort these items BUT on the same sheet now.
Basically the range of names / items sold just need to be sorted in the same range each time my button is pressed.
If any help to you the existing working code is shown below,"this copies from one sheet & sorts & thes pastes on another sheet"
Code:
Sub LEADERBOARD() '' leaderboard Macro' Worksheets("HONDA SHEET").Range("C1:D13").Copy Worksheets("SOLD ITEMS").Range("C1:D14")
Worksheets("HONDA SHEET").Range("E1:F13").Copy Worksheets("SOLD ITEMS").Range("C14:D26")
ActiveWorkbook.Worksheets("SOLD ITEMS").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("SOLD ITEMS").Sort.SortFields.Add Key:=Range("D1"), _
SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _
xlSortTextAsNumbers
With Worksheets("SOLD ITEMS").Sort
.SetRange Range("C1:D26")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
With Worksheets("SOLD ITEMS").Range("C1:D26").Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 65535
End With
Application.Goto Sheets("SOLD ITEMS").Range("A4")
End Sub