'Drop Down liste 1
Private Sub UserForm_Initialize()
Sheets("Ark2").Select
Dim ws As Worksheet
Dim rCombo As Range
'set a variable to the sheet with the list
Set ws = Sheet2
'define the list
With ws
Set rCombo = .Range("C3:C15")
End With
'populate the combobox using the List Property
Me.ComboBox1.List = rCombo.Value
Sheets("Ark2").Select
Dim mg As Worksheet
Dim mgCombo As Range
'set a variable to the sheet with the list
Set mg = Sheet2
'define the list
With mg
Set mgCombo = .Range("M3:M12")
End With
'populate the combobox using the List Property
Me.ComboBox3.List = mgCombo.Value
Sheets("Ark2").Select
Dim mgg As Worksheet
Dim mggCombo As Range
'set a variable to the sheet with the list
Set mgg = Sheet2
'define the list
With mgg
Set mggCombo = .Range("N3:N10")
End With
'populate the combobox using the List Property
Me.ComboBox2.List = mggCombo.Value
'Bilagsnr. default
Sheets("Konteringsliste").Select
Dim bilagsnrfelt As Range
Set bilagsnrfelt = Range("b6:b95")
forrigebilagsnr = Application.Max(bilagsnrfelt)
Bilagsnummer = forrigebilagsnr + 1
Me.TextBox3.Text = Bilagsnummer
'Sett case til ComboBox1. Text
Select Case Me.ComboBox1.Text
'"Case" = Sjekker hva som står i ComboBox 1 for så å postere dette!
Case Me.ComboBox1
'Søke
Cells.Find(What:=Me.ComboBox1, After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False).Activate
Tekst = ActiveCell.Text
Selection.Offset(0, 1).Select
Debet = ActiveCell.Value
Selection.Offset(0, 1).Select
DebetKonto = ActiveCell.Value
Selection.Offset(0, 1).Select
DebetMva = ActiveCell.Value
Selection.Offset(0, 1).Select
Kredit = ActiveCell.Value
Selection.Offset(0, 1).Select
KreditKonto = ActiveCell.Value
Selection.Offset(0, 1).Select
KreditMva = ActiveCell.Value
End Select
'Sett data hentet som default i tekstboksene
Me.TextBox7.Text = Tekst
Me.TextBox8.Value = Debet
Me.TextBox9.Value = Kredit
Me.TextBox10.Text = DebetKonto
Me.TextBox13.Text = KreditKonto
Me.TextBox11.Value = DebetMva
Me.TextBox12.Value = KreditMva
End Sub
Hello.
I get this error message when I try to run it "runtime error 91 object variable or With block variable not set"
It is part of a UserForm.
This is the part that creates problems.
Select Case Me.ComboBox1.Text
'"Case" = Sjekker hva som står i ComboBox 1 for så å postere dette!
Case Me.ComboBox1
'Søke
Cells.Find(What:=Me.ComboBox1, After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False).Activate
Tekst = ActiveCell.Text
Selection.Offset(0, 1).Select
Debet = ActiveCell.Value
Selection.Offset(0, 1).Select
DebetKonto = ActiveCell.Value
Selection.Offset(0, 1).Select
DebetMva = ActiveCell.Value
Selection.Offset(0, 1).Select
Kredit = ActiveCell.Value
Selection.Offset(0, 1).Select
KreditKonto = ActiveCell.Value
Selection.Offset(0, 1).Select
KreditMva = ActiveCell.Value
End Select
'Sett data hentet som default i tekstboksene
Me.TextBox7.Text = Tekst
Me.TextBox8.Value = Debet
Me.TextBox9.Value = Kredit
Me.TextBox10.Text = DebetKonto
Me.TextBox13.Text = KreditKonto
Me.TextBox11.Value = DebetMva
Me.TextBox12.Value = KreditMva
It is something that is at the Norwegian. Because I am a Norwegian
Bookmarks