Diverse vragen / problemen

Status
Niet open voor verdere reacties.

Bosswilly

Gebruiker
Lid geworden
28 mrt 2016
Berichten
110
Goedendag,

Ik heb een paar dingen, waar ik niet uit kom, nl.:

* Label 21 wil ik laten berekenen uit de textboxen conform de formule ON=((AB-AO)/AB)*AM?
* Hoe krijg ik deze gegevens uiteindelijk in de cellen geplaatst, ook als ik daarna een volgende rij voor een nieuwe opgaaf bij wil plaatsen?
* Bij Combobox2 krijg ik niet de lijst te zien, zoals ik dat bij combobox1 wel te zien krijg. Hoe kan dat?
* Bij tabellen moet bij het juiste option button een "X" in het tabel plaatsen.

Alvast bedankt.

Bekijk bijlage 331174
 
Je kan maar 1 userform_initialize event gebruiken. Een event toevoegen met een 2 erachter heeft geen zin.

Code:
Private Sub UserForm_Initialize()
For i = 1 To 2
Controls("Combobox" & i).List = Array(, "1,5", "2,5", "4", "6", "10", "16", "25", "35", "50", "70", "95", "120", "150", "185", "240", "300", "400", "500", "630", "800", "1000")
Next
End Sub
 
Laatst bewerkt:
Ik zal er straks eens naar kijken. (als er mij niemand voor is)
Uw vraag betreffende de comboboxen kan ik zo beantwoorden, UserForm_Initialize2 bestaat niet.
Je moet de beide codes gewoon in hetzelfde UserForm_Initialize event zetten.

Edit: Speedy SjonR was mij voor. :d
 
Laatst bewerkt:
voor het label bijvoorbeeld:

Code:
Private Sub TextBox6_Change()
Label21.Caption = ((TextBox4.Value - TextBox3.Value) / TextBox4.Value) * TextBox6.Value
End Sub

Wegschrijven naar tabel:

Code:
Private Sub CommandButton1_Click()
With Blad3
    LR = .Range("A" & Rows.Count).End(xlUp).Row + 1
    .Cells(LR, 1).Resize(, 9) = Array(TextBox1.Value, TextBox2.Value, ComboBox1.Value, TextBox3.Value, TextBox4.Value, ComboBox2.Value, TextBox5.Value, TextBox6.Value, Label21.Caption)
    If OptionButton1 Then .Cells(LR, 10).Value = "X"
    If OptionButton2 Then .Cells(LR, 11).Value = "X"
    If OptionButton3 Then .Cells(LR, 12).Value = "X"
End With
End Sub

Maar dit zal bij eerste invoer fout gaan omdat je samengevoegde cellen gebruikt. Die zou ik er direct uithalen, want dat zorgt altijd voor problemen in combinatie met VBA
 
Laatst bewerkt:
iets anders geschreven

Code:
Private Sub UserForm_Initialize()
  ComboBox1.List = Split("1,5 2,5 4 6 10 16 25 35 50 70 95 120 150 185 240 300 400 500 630 800 1000")
  ComboBox2.List = ComboBox1.List
End Sub

Code:
Private Sub CommandButton1_Click()
  With Blad3
    lr = .Range("A" & Rows.Count).End(xlUp).Row + 1
    .Cells(lr, 1).Resize(, 9) = Array(TextBox1.Value, TextBox2.Value, ComboBox1.Value, TextBox3.Value, TextBox4.Value, ComboBox2.Value, TextBox5.Value, TextBox6.Value, Label21.Caption)
    For j = 1 To 3
      If Me("OptionButton" & j) Then .Cells(lr, 9 + j) = "X"
    Next j
  End With
End Sub
 
Super heren,

Mag ik jullie hartelijk danken hiervoor.

Hiermee kan ik enorm uit de voeten.

Nogmaals dank.:thumb::thumb::thumb:
 
Aan aliassen kun je niet afleiden of je met heren te maken hebt. Maak het forum niet onnodig vrouwonvriendelijk. Hou het neutraal..

@VenA

nog anders

Code:
Private Sub CommandButton1_Click()
  Blad3.Cells(rows.count,1).end(xlup).offset(1).Resize(, 12) = Array(TextBox1.Value, TextBox2.Value, ComboBox1.Value, TextBox3.Value, TextBox4.Value, ComboBox2.Value, TextBox5.Value, TextBox6.Value, Label21.Caption,iif(optionbutton1,"X",""),iif(optionbutton2,"X",""),iif(optionbutton3,"X",""))
End Sub
 
Zo?
Code:
Private Sub ComboBox2_Change()
  Select Case ComboBox2.Value
    Case Is > 35
      Label22.Caption = ComboBox2.Value / 2
    Case Is > 16
      Label22.Caption = 16
    Case Is <= 16
      Label22.Caption = ComboBox2.Value
  End Select
End Sub
 
@Jack Nouws, je zit in het verkeerde draadje:d

Kan ook zo
Code:
Private Sub ComboBox1_Change()
  Label22.Caption = IIf(ComboBox1.ListIndex = -1, "", IIf(ComboBox1.Value > 35, ComboBox1.Value / 2, Application.Min(16, ComboBox1.Value)))
End Sub
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan