1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| On Error Resume Next
If TextBox3.Value = "" Then
TextBox3.Value = "0"
End If
TextBox4.Value = CDbl(Me.TextBox1) + CDbl(Me.TextBox3)
Dim dllgn, i, wrgst
If ListBox1.ListIndex = -1 Then Exit Sub
If ComboBox1.ListIndex = -1 Or ComboBox2.ListIndex = -1 Then Exit Sub
Set wrgst = Sheets(ComboBox1.Value)
With wrgst
dllgn = ListBox1.ListIndex + 6: 'MsgBox ListBox1.ListIndex & " " & dllgn
Range(.Cells(dllgn, 1 + (ComboBox2.ListIndex * 5)), .Cells(dllgn, 2 + (ComboBox2.ListIndex * 5))).ClearContents
For i = 5 To ListBox1.ListCount + 5
If .Cells(i, 1 + (ComboBox2.ListIndex * 5)).Value & "" & .Cells(i, 2 + (ComboBox2.ListIndex * 5)).Value = "" Then
Range(.Cells(i, 1 + (ComboBox2.ListIndex * 5)), .Cells(i, 2 + (ComboBox2.ListIndex * 5))).Value = _
Range(.Cells(i, 1 + (ComboBox2.ListIndex * 5)), .Cells(i, 2 + (ComboBox2.ListIndex * 5))).Value
.Cells(i, 1 + (ComboBox2.ListIndex * 5)).Value = Label7.Caption
.Cells(i, 2 + (ComboBox2.ListIndex * 5)).Value = TextBox4.Value
End If
Next
End With
TextBox4.Value = ""
TextBox3.Value = "" |
Partager