korhan
Board Regular
- Joined
- Nov 6, 2009
- Messages
- 215
I am trying to make a userform which will return a certain value if it finds the value in the worksheet.
I just need the textbox value for me to wait till i hit ok to search the value. Also when I do erase I don't want it to do anything and if the value is not found I want a msgbox to pop up and say No value is found. And after I hit ok on msgbox I want search box to reset itself.
This seems really hard. I am not familiar with userforms so please try to explain as much as possible or take it easy on me.
Private Sub cmdcancel_Click() Unload Me
End Sub
Private Sub cmdok_Click()
If Me.txtlogoname.Value = "" Then
MsgBox "Please enter a logo name"
Me.txtlogoname.SetFocus
End If
End Sub
Private Sub cmdreset_Click()
Unload UserForm1
UserForm1.Show
End Sub
Private Sub txtlogoname_Change()
FindValue = Me.txtlogoname.Value
Cells.Find(What:=FindValue, After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Activate
txtboxno.Text = ActiveCell.Offset(0, 4).Value
If FindValue.Value Then
On Error Resume Next
MsgBox "Logo does not exist"
UserForm1.Show
'Unload UserForm1
'UserForm1.Show
Me.txtlogoname.SetFocus
End Sub
I just need the textbox value for me to wait till i hit ok to search the value. Also when I do erase I don't want it to do anything and if the value is not found I want a msgbox to pop up and say No value is found. And after I hit ok on msgbox I want search box to reset itself.
This seems really hard. I am not familiar with userforms so please try to explain as much as possible or take it easy on me.
Private Sub cmdcancel_Click() Unload Me
End Sub
Private Sub cmdok_Click()
If Me.txtlogoname.Value = "" Then
MsgBox "Please enter a logo name"
Me.txtlogoname.SetFocus
End If
End Sub
Private Sub cmdreset_Click()
Unload UserForm1
UserForm1.Show
End Sub
Private Sub txtlogoname_Change()
FindValue = Me.txtlogoname.Value
Cells.Find(What:=FindValue, After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Activate
txtboxno.Text = ActiveCell.Offset(0, 4).Value
If FindValue.Value Then
On Error Resume Next
MsgBox "Logo does not exist"
UserForm1.Show
'Unload UserForm1
'UserForm1.Show
Me.txtlogoname.SetFocus
End Sub