AW: Ganzer Code zeigen, oder Beispielmappe! (owT)
26.03.2020 08:06:59
EtoPHG
Hallo,
Probier mal:
Private Sub CommandButton2_Click()
Dim lastCol As Long
lastCol = Cells(1, Columns.Count).End(xlToLeft).Column
lastCol = lastCol + 1
If lastCol = 2 And IsEmpty(Cells(1, 1)) Then lastCol = 1
If vbYes = MsgBox("Die letzte gefüllte Spalte ist " & (lastCol - 1) & vbCrLf & _
"Wollen Sie die Spalte " & lastCol & " jetzt erstellen?", _
vbYesNo + vbExclamation, "Wert in lastcol kopieren") Then
Cells(1, lastCol) = ComboBox1.Value * ComboBox2.Value
Cells(2, lastCol) = ComboBox3.Value * ComboBox4.Value
Cells(3, lastCol) = ComboBox5.Value * ComboBox6.Value
Cells(4, lastCol) = ComboBox7.Value * ComboBox8.Value
Cells(5, lastCol) = ComboBox9.Value * ComboBox10.Value
Cells(6, lastCol) = ComboBox11.Value * ComboBox12.Value
Cells(7, lastCol) = ComboBox13.Value * ComboBox14.Value
Cells(8, lastCol) = ComboBox15.Value * ComboBox16.Value
Cells(9, lastCol) = ComboBox17.Value * ComboBox18.Value
End If
End Sub
Gruess Hansueli