bpgolferguy
Active Member
- Joined
- Mar 1, 2009
- Messages
- 469
Hi, I currently have this code in a button:
The very last part where I sort is what's giving me fits. Starting with ".Range("A2:F400") is what it highlights and gives me an error when I click the button. Anyone know why?
Code:
Private Sub TourPlayers_Click()
With Workbooks("MemberDatabase.xls").Worksheets("TourPlayers")
.Range("A2:E300").ClearContents
End With
'First Name
With Workbooks("MemberDatabase.xls").Worksheets("Members")
.Range("A4").Resize(.Range("AD1").Value).Copy
End With
With Workbooks("MemberDatabase.xls").Worksheets("TourPlayers")
.Range("C2").PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
End With
'Last Name
With Workbooks("MemberDatabase.xls").Worksheets("Members")
.Range("B4").Resize(.Range("AD1").Value).Copy
End With
Worksheets("TourPlayers").Range("D2").PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
'KJGT Division
With Workbooks("MemberDatabase.xls").Worksheets("Members")
.Range("D4").Resize(.Range("AD1").Value).Copy
End With
Worksheets("TourPlayers").Range("E2").PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
'M/W Division
With Workbooks("MemberDatabase.xls").Worksheets("Members")
.Range("F4").Resize(.Range("AD1").Value).Copy
End With
Worksheets("TourPlayers").Range("F2").PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
With Workbooks("MemberDatabase.xls").Worksheets("TourPlayers")
.Range("A2:F400").Select
Selection.Sort Key1:=Range("F2"), Order1:=xlAscending, Key2:=Range("E2") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom
Range("AD2").Select
End With
End Sub