ongtrungducmx25
Thành viên gạo cội
- Tham gia
- 5/2/07
- Bài viết
- 2,077
- Được thích
- 1,986
- Nghề nghiệp
- GV
Xin cho hỏi khi em chọn một vung dữ liệu để nhập số tự nhiên từ 0 đến 10 chỉ được 10cell có cách nào chọn được nhiều cell không sau đây là đoạn
Code:
Không biết sai ở đâu mong được chỉ thêm !
Code:
Mã:
[FONT=Times New Roman][SIZE=3]Private Sub chon_Click()[/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3] Dim RandList(0 To 1000) As Integer[/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3] Dim Count As Integer[/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3] Dim num As Integer[/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3] Count = 0[/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3] Randomize[/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3] For Each C In Selection[/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3] FindRand:[/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3] num = Int(Rnd * 10 + 1)[/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3] For i = 0 To Count[/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3] If num = RandList(i) Then GoTo FindRand[/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3] Next[/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3] C.Value = num[/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3] RandList(Count) = num[/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3] Count = Count + 1[/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3] Next[/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3]End Sub[/SIZE][/FONT]
Chỉnh sửa lần cuối bởi điều hành viên: