Pick 4 Code:

Option Explicit 
Dim A As Integer, B As Integer, C As Integer, D As Integer 
Dim X As Double 

Sub CombininationsPick4() 

Columns("A:E").Select 
    Selection.ClearContents 
    Range("G1").Select 
    
' Generates all combinations for a pick-4 lottery 

Range("A1").Select 

X = 1 

For A = 0 To 9 
For B = 0 To 9 
For C = 0 To 9 
For D = 0 To 9 

ActiveCell.Offset(X, 0).Value = X 
ActiveCell.Offset(X, 1).Value = A 
ActiveCell.Offset(X, 2).Value = B 
ActiveCell.Offset(X, 3).Value = C 
ActiveCell.Offset(X, 4).Value = D 

X = X + 1 

Next D 
Next C 
Next B 
Next A 

End Sub 

===============================================

Pick 3 Code:

Option Explicit 
Dim A As Integer, B As Integer, C As Integer 

Dim X As Double 

Sub CombininationsPick3() 

Columns("A:D").Select 
    Selection.ClearContents 
    Range("G1").Select 
    
' Generates all combinations for a pick-3 lottery 

Range("A1").Select 

X = 1 

For A = 0 To 9 
For B = 0 To 9 
For C = 0 To 9 


ActiveCell.Offset(X, 0).Value = X 
ActiveCell.Offset(X, 1).Value = A 
ActiveCell.Offset(X, 2).Value = B 
ActiveCell.Offset(X, 3).Value = C 


X = X + 1 


Next C 
Next B 
Next A 

End Sub