Jeg forstår ikke lig hvor du vil sætte variablen i ind jeg har taget en kopi af userformen der står det samme i som den jeg har taget en kopi af og den virker
Jeg forstår ikke lig hvor du vil sætte variablen i ind jeg har taget en kopi af en userformen og kopi den over i en anden excelfil der står det samme i begge to men den ene virker ikke
Private Sub CommandButton1_Click() Liste_medlemmer.Show End Sub
Private Sub CommandButton2_Click() Dim o As Long Dim tb As String Dim i txtPart.Text = "" txtNavn.Text = "" txtEfternavn.Text = "" txtAdresse.Text = "" txtPostnr.Text = "" txtBy.Text = "" txtCprnr.Text = "" txtMailAdresse.Text = ""
With Sheets("Medlemmer")
o = .Range("A65000").End(xlUp).Row tb = TextBox1.Text For i = 2 To o + 1 If LCase(.Cells(i, 1).Value) = LCase(tb) Then txtPart.Text = .Cells(i, 1).Value txtNavn.Text = .Cells(i, 2).Value txtEfternavn.Text = .Cells(i, 3).Value txtAdresse.Text = .Cells(i, 4).Value txtPostnr.Text = .Cells(i, 5).Value txtBy.Text = .Cells(i, 6).Value txtCprnr.Text = .Cells(i, 7).Value txtMailAdresse.Text = .Cells(i, 8).Value Exit For Else: If i = o Then MsgBox ("Ingen fundet") End If Next i
End With
End Sub
Private Sub CommandButton3_Click() With Sheets("Medlemmer")
.Cells(i, 1).Value = txtPart.Text .Cells(i, 2).Value = txtNavn.Text .Cells(i, 3).Value = txtEfternavn.Text .Cells(i, 4).Value = txtAdresse.Text .Cells(i, 5).Value = txtPostnr.Text .Cells(i, 6).Value = txtBy.Text .Cells(i, 7).Value = txtCprnr.Text .Cells(i, 8).Value = txtMailAdresse.Text End With End Sub
Private Sub CommandButton4_Click() Dim Cancel As Boolean Dim a
a = MsgBox("Du er ved at slette vil du det ", vbYesNo)
With Sheets("Medlemmer") If a = vbNo Then Cancel = True Else .Cells(i, 1).Value = "" .Cells(i, 2).Value = "" .Cells(i, 3).Value = "" .Cells(i, 4).Value = "" .Cells(i, 5).Value = "" .Cells(i, 6).Value = "" .Cells(i, 7).Value = "" .Cells(i, 8).Value = "" .Cells(i, 9).Value = "" End If End With End Sub
Private Sub CommandButton5_Click() 'clear textboxe for data' txtPart.Value = "" txtNavn.Value = "" txtEfternavn.Value = "" txtAdresse.Value = "" txtPostnr.Value = "" txtBy.Value = "" txtCprnr.Value = "" txtMailAdresse.Value = "" TextBox1.Value = "" End Sub
Private Sub Label10_Click() 'Her henter vi sidste anvendt id nr' Me.Label10.Caption = Application.WorksheetFunction.Large(Sheets("Medlemmer").Range("A2:A170"), 1)
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, _ CloseMode As Integer) If CloseMode = vbFormControlMenu Then Cancel = True MsgBox "Brug knappen!" End If End Sub
o = .Range("A65000").End(xlUp).Row tb = TextBox1.Text For i = 2 To o + 1 If LCase(.Cells(i, 1).Value) = LCase(tb) Then txtPart.Text = .Cells(i, 1).Value txtNavn.Text = .Cells(i, 2).Value txtEfternavn.Text = .Cells(i, 3).Value txtAdresse.Text = .Cells(i, 4).Value txtPostnr.Text = .Cells(i, 5).Value txtBy.Text = .Cells(i, 6).Value txtCprnr.Text = .Cells(i, 7).Value txtMailAdresse.Text = .Cells(i, 8).Value Exit For Else: If i = o Then MsgBox ("Ingen fundet") End If Next i
End With
End Sub
Det var her der var fejl
Private Sub CommandButton2_Click() Dim o As Long Dim tb As String
o = .Range("A65000").End(xlUp).Row tb = TextBox1.Text For i = 2 To o + 1 If LCase(.Cells(i, 1).Value) = LCase(tb) Then txtPart.Text = .Cells(i, 1).Value txtNavn.Text = .Cells(i, 2).Value txtEfternavn.Text = .Cells(i, 3).Value txtAdresse.Text = .Cells(i, 4).Value txtPostnr.Text = .Cells(i, 5).Value txtBy.Text = .Cells(i, 6).Value txtCprnr.Text = .Cells(i, 7).Value txtMailAdresse.Text = .Cells(i, 8).Value Exit For Else: If i = o Then MsgBox ("Ingen fundet") End If Next i
o = .Range("A65000").End(xlUp).Row tb = TextBox1.Text For i = 2 To o + 1 If LCase(.Cells(i, 1).Value) = LCase(tb) Then txtPart.Text = .Cells(i, 1).Value txtNavn.Text = .Cells(i, 2).Value txtEfternavn.Text = .Cells(i, 3).Value txtAdresse.Text = .Cells(i, 4).Value txtPostnr.Text = .Cells(i, 5).Value txtBy.Text = .Cells(i, 6).Value txtCprnr.Text = .Cells(i, 7).Value txtMailAdresse.Text = .Cells(i, 8).Value Exit For Else: If i = o Then MsgBox ("Ingen fundet") End If Next i
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.