Sub YXCS()
Dim d As Object, i&, j&
DoCmd.SetWarnings False
Randomize
Set d = CreateObject("scripting.dictionary")
For j = 1 To 6
For i = 1 To 6
line1:
x = Int(Rnd * 33) + 1
If Not d.exists(x) Then d.Add x, "" Else GoTo line1
Next i
DoCmd.RunSQL "Insert into 表1( 壹,贰,叁,肆,伍,陆) VALUES(" & x & "," & x & "," & x & "," & x & "," & x & "," & x & ")"
Private Sub Command1_Click()
Dim i As Integer, A As Integer, B As Integer, C As String
A = InputBox("请输入年份", "某年每个月的第一天是星期几", 2012)
Form1.Cls
For i = 1 To 12
C = A & "-" & Format(i, "00") & "-1"
B = Weekday(C)
Select Case B
Case vbSunday
Print A & "年" & Format(i, "00") & "月1日是 星期日"
Case vbMonday
Print A & "年" & Format(i, "00") & "月1日是 星期一"
Case vbTuesday
Print A & "年" & Format(i, "00") & "月1日是 星期二"
Case vbWednesday
Print A & "年" & Format(i, "00") & "月1日是 星期三"
Case vbThursday
Print A & "年" & Format(i, "00") & "月1日是 星期四"
Case vbFriday
Print A & "年" & Format(i, "00") & "月1日是 星期五"
Case vbSaturday
Print A & "年" & Format(i, "00") & "月1日是 星期六"
End Select
Next i
End Sub作者: zhangz9 时间: 2012-9-25 21:36
学习了