littlepete
Well-known Member
- Joined
- Mar 26, 2015
- Messages
- 507
- Office Version
- 365
- Platform
- Windows
hello
i have a perfectly well working inputbox asking if you would like to see the parents / mother / father of the person in the activerow.
no problems with option 2 and 3 and no problem with choosing mother in option 1.
is an inputbox keeping some kind of memory that could make the choice to see only the father ('s row) a problem?
each row is a person: the name is in column B. mother's name in CP; father's name in CQ. if it is a name in non latin letters,
the transcription is in CS and CT.
the inputbox finds the column of the activerow for mother/father's name then search for that name (identical) in column B.
all is working well, except for choosing father's name when both are available.
thank you for your opinion and advice !!!
this is the code:
i have a perfectly well working inputbox asking if you would like to see the parents / mother / father of the person in the activerow.
no problems with option 2 and 3 and no problem with choosing mother in option 1.
is an inputbox keeping some kind of memory that could make the choice to see only the father ('s row) a problem?
each row is a person: the name is in column B. mother's name in CP; father's name in CQ. if it is a name in non latin letters,
the transcription is in CS and CT.
the inputbox finds the column of the activerow for mother/father's name then search for that name (identical) in column B.
all is working well, except for choosing father's name when both are available.
thank you for your opinion and advice !!!
this is the code:
VBA Code:
Sub vindouders() ' ------------------------------------------------------------------------------------------------- [ F4 ]
Dim keuze As Variant
Dim zoekmam As Range
Dim zoekpap As Range
Dim zoekma As Variant
Dim zoekpa As Variant
Dim dezerij As Long
Dim aantalcontacten As Variant
aantalcontacten = Worksheets("gegevens").Cells.SpecialCells(xlCellTypeLastCell).Row - 4
dezerij = ActiveCell.Row
zoekma = "*" & Range("cp" & dezerij).Value & "*"
Set zoekmam = Range("rngpersoon").Find(zoekma, , xlValues, xlWhole)
zoekpa = "*" & Range("cq" & dezerij).Value & "*"
Set zoekpap = Range("rngpersoon").Find(zoekpa, , xlValues, xlWhole)
' ========================================================== geen ma geen pa
If zoekmam Is Nothing And zoekpap Is Nothing Then
MsgBox Range("m" & dezerij).Value & " " & UCase(Range("n" & dezerij).Value) & Chr(10) & _
"heeft geen ouders staan in deze lijst. "
Exit Sub
End If
' ========================================================== wel ma wel pa
If Range("cp" & dezerij).Value <> "" And Range("cq" & dezerij).Value <> "" Then
If Range("cs" & dezerij).Value <> "" Or Range("ct" & dezerij).Value <> "" Then
keuze = InputBox(Chr(10) & _
"Deze lijst bevat " & aantalcontacten & " contacten." & Chr(10) & Chr(10) & _
"De ouders bekijken van " & Chr(10) & Range("p" & dezerij).Value & " : " & Chr(10) & _
"______________________________________________________" & Chr(10) & _
"tik 0 om dit scherm te verlaten." & Chr(10) & _
"tik 1 om naar " & Range("cs" & dezerij).Value & " te gaan" & Chr(10) & _
"tik 2 om naar " & Range("ct" & dezerij).Value & " te gaan" & Chr(10) & _
Chr(10), "OUDERS BEKIJKEN VAN " & Range("m" & dezerij).Value & " " & UCase(Range("n" & dezerij).Value), , 11000, 10000)
Else
keuze = InputBox(Chr(10) & _
"Deze lijst bevat " & aantalcontacten & " contacten." & Chr(10) & Chr(10) & _
"De ouders bekijken van " & Chr(10) & Range("m" & dezerij).Value & " " & UCase(Range("n" & dezerij).Value) & " : " & Chr(10) & _
"______________________________________________________" & Chr(10) & _
"tik 0 om dit scherm te verlaten." & Chr(10) & _
"tik 1 om naar " & Range("cp" & dezerij).Value & " te gaan" & Chr(10) & _
"tik 2 om naar " & Range("cq" & dezerij).Value & " te gaan" & Chr(10) & _
Chr(10), "OUDERS BEKIJKEN VAN " & Range("m" & dezerij).Value & " " & UCase(Range("n" & dezerij).Value), , 11000, 10000)
End If
Select Case keuze
Case 0
GoTo einde
Case 1
Range(zoekmam.Address).Select
Exit Sub
Case 2
Range(zoekpap.Address).Select ' ==================================================== hier zit altijd een fout ==================
Exit Sub
End Select
End If
[...]