Tugas Mahasiswa

Menenmpatkan posisi dalam cel Excel (VBA Excel)

Dipublikasikan pada : 29 Januari 2020.

Private Sub CommandButton1_Click()
For a = 1 To 1
For b = 1 To 3
Cells(6 + b, 1 + a) = Cells(5, 1) & Cells(5, a + 1) & Cells(5, b + 2)
Cells(6 + b, 2 + a) = Cells(5, 1) & Cells(5, b + 2) & Cells(5, a + 1)

Cells(9 + b, 1 + a) = Cells(5, 1) & Cells(5, a + 2) & Cells(5, b + 3)
Cells(9 + b, 2 + a) = Cells(5, 1) & Cells(5, b + 3) & Cells(5, a + 2)

Cells(12 + b, 1 + a) = Cells(5, 1) & Cells(5, a + 3) & Cells(5, b + 4)
Cells(12 + b, 2 + a) = Cells(5, 1) & Cells(5, b + 4) & Cells(5, a + 3)

Range(“b12”) = Range(“b13”)
Range(“c12”) = Range(“c13”)
Cells(12 + b, 2).Font.Color = vbWhite
Cells(12 + b, 3).Font.Color = vbWhite

Cells(6 + b, 3 + a) = Cells(5, 6) & Cells(5, a + 6) & Cells(5, b + 7)
Cells(6 + b, 4 + a) = Cells(5, 6) & Cells(5, b + 7) & Cells(5, a + 6)

Cells(9 + b, 3 + a) = Cells(5, 6) & Cells(5, a + 7) & Cells(5, b + 8)
Cells(9 + b, 4 + a) = Cells(5, 6) & Cells(5, b + 8) & Cells(5, a + 7)

Cells(12 + b, 3 + a) = Cells(5, 6) & Cells(5, a + 8) & Cells(5, b + 9)
Cells(12 + b, 4 + a) = Cells(5, 6) & Cells(5, b + 9) & Cells(5, a + 8)

Range(“d12”) = Range(“d13”)
Range(“e12”) = Range(“e13”)
Cells(12 + b, 4).Font.Color = vbWhite
Cells(12 + b, 5).Font.Color = vbWhite

Cells(6 + b, 5 + a) = Cells(6, 1) & Cells(6, a + 1) & Cells(6, b + 2)
Cells(6 + b, 6 + a) = Cells(6, 1) & Cells(6, b + 2) & Cells(5, a + 1)

Cells(9 + b, 5 + a) = Cells(6, 1) & Cells(6, a + 2) & Cells(6, b + 3)
Cells(9 + b, 6 + a) = Cells(6, 1) & Cells(6, b + 3) & Cells(6, a + 2)

Cells(12 + b, 5 + a) = Cells(6, 1) & Cells(6, a + 3) & Cells(6, b + 4)
Cells(12 + b, 6 + a) = Cells(6, 1) & Cells(6, b + 4) & Cells(6, a + 3)

Range(“f12”) = Range(“f13”)
Range(“g12”) = Range(“g13”)
Cells(12 + b, 6).Font.Color = vbWhite
Cells(12 + b, 7).Font.Color = vbWhite

Cells(6 + b, 7 + a) = Cells(6, 6) & Cells(6, a + 6) & Cells(6, b + 7)
Cells(6 + b, 8 + a) = Cells(6, 6) & Cells(6, b + 7) & Cells(6, a + 6)

Cells(9 + b, 7 + a) = Cells(6, 6) & Cells(6, a + 7) & Cells(6, b + 8)
Cells(9 + b, 8 + a) = Cells(6, 6) & Cells(6, b + 8) & Cells(6, a + 7)

Cells(12 + b, 7 + a) = Cells(6, 6) & Cells(6, a + 8) & Cells(6, b + 9)
Cells(12 + b, 8 + a) = Cells(6, 6) & Cells(6, b + 9) & Cells(6, a + 8)

Range(“h12”) = Range(“h13”)
Range(“i12”) = Range(“i13”)
Cells(12 + b, 8).Font.Color = vbWhite
Cells(12 + b, 9).Font.Color = vbWhite

Cells(6 + b, 9 + a) = Cells(4, 1) & Cells(4, a + 1) & Cells(4, b + 2)
Cells(6 + b, 10 + a) = Cells(4, 1) & Cells(4, b + 2) & Cells(4, a + 1)

Cells(9 + b, 9 + a) = Cells(4, 1) & Cells(4, a + 2) & Cells(4, b + 3)
Cells(9 + b, 10 + a) = Cells(4, 1) & Cells(4, b + 3) & Cells(4, a + 2)

Cells(12 + b, 9 + a) = Cells(4, 1) & Cells(4, a + 3) & Cells(4, b + 4)
Cells(12 + b, 10 + a) = Cells(4, 1) & Cells(4, b + 4) & Cells(4, a + 3)

Range(“j12”) = Range(“j13”)
Range(“k12”) = Range(“k13”)
Cells(12 + b, 10).Font.Color = vbWhite
Cells(12 + b, 11).Font.Color = vbWhite
Next b
Next a
End Sub

Private Sub CommandButton2_Click()
For a = 1 To 12
For b = 1 To 12
Cells(6 + b, 1 + a) = “”
Next b
Next a
End Sub