In my program that's connected to a form I have code like:
AND
Is there anyway to right this using a loop. I don't know how to stick in number variables in the statements [TextExist("A-2-A1")] and [Me.L10,BackColor=1677960]. I think there must be a way tho. And is there any way of writing all those functions as one function with a variable in the name of the function? THANKS.
Code:
'Row 1
If TextExist("A-2-A1") Then
Me.L1.BackColor = 16776960
End If
If TextExist("A-2-A2") Then
Me.L2.BackColor = 16776960
End If
If TextExist("A-2-A3") Then
Me.L3.BackColor = 16776960
End If
If TextExist("A-2-A4") Then
Me.L4.BackColor = 16776960
End If
If TextExist("A-2-A5") Then
Me.L5.BackColor = 16776960
End If
If TextExist("A-2-A6") Then
Me.L6.BackColor = 16776960
End If
If TextExist("A-2-A7") Then
Me.L7.BackColor = 16776960
End If
If TextExist("A-2-A8") Then
Me.L8.BackColor = 16776960
End If
If TextExist("A-2-A9") Then
Me.L9.BackColor = 16776960
End If
If TextExist("A-2-A10") Then
Me.L10.BackColor = 16776960
End If
Code:
Private Sub L1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Me.L1.BackColor = 16776960 Then
Update ("A-1-A1")
Me.L1.BackColor = 65535
End If
End Sub
Private Sub L2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Me.L2.BackColor = 16776960 Then
Update ("A-1-A2")
Me.L2.BackColor = 65535
End If
End Sub
Private Sub L3_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Me.L3.BackColor = 16776960 Then
Update ("A-1-A3")
Me.L3.BackColor = 65535
End If
End Sub
'etc.
Is there anyway to right this using a loop. I don't know how to stick in number variables in the statements [TextExist("A-2-A1")] and [Me.L10,BackColor=1677960]. I think there must be a way tho. And is there any way of writing all those functions as one function with a variable in the name of the function? THANKS.