OK, to do it on the worksheet without VBA:
Enter 1 and 2 in row 1 and 2 of any column.
Drag down to get a list of integers 1 to 52
In Row 1 of the adjacent column enter =Rand()
Double click on the bottom right hand corner to fill rows 1 to 52 with random numbers.
Sort both columns using the random number column as the key.
To do that from VBA:
Set up a spreadsheet as above.
Name the two column range “ShuffleRange” and the second column “RandRange”
Enter VBA code:
Sub Shuffle()
Dim ShuffleRange As Variant, Cards(1 To 52) As Long, i As Long
ActiveWorkbook.Worksheets(“Sheet1”).Sort.SortFields.Clear
ActiveWorkbook.Worksheets(“Sheet1”).Sort.SortFields.Add2 Key:=Range(“RandRange”) _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets(“Sheet1”).Sort
.SetRange Range(“ShuffleRange”)
.Apply
End With
ShuffleRange = Range(“ShuffleRange”).Value2
For i = 1 To 52
Cards(i) = ShuffleRange(i, 1)
Next i
End Sub
Save the worksheet as xlsm or xlsb.
Its probably even easier with the new sort function, but that won’t yet work with most versions of Excel.
You could also do it entirely from VBA using a VBA sort function. There isn’t a built in one, but you can download a free one from my blog if you are interested.