View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
dan dungan dan dungan is offline
external usenet poster
 
Posts: 411
Default listbox selection to load to new form

Hi,

I'm wondering how you know it's not working.

Which line of code produces what error?

Dan


On Nov 1, 8:24 am, wrote:
Any help would be Greatly Appreciated!!!!
userForm1 Has a listbox with a list of names, When the name is
Selected it needs to search 3 sheets, then Make The Sheet That The
name is on to be Active, and load the corresponding from specified
cells how would this is what i have come up with so far but its not
working :|

Private Function StrFind(StrList As String)
Dim SearchTxt As String
Dim rng As Range
Dim sh As Worksheet

With ThisWorkbook.ActiveSheet
If ListBox.Text = "" Then
GoTo ErrorHandler
End If

TextBox1.Text = LstBox.Text

SearchTxt = FrmSelection.LboxSelect.Text
Set sh = ActiveSheet
Set rng = sh.Cells.Find(What:=SearchTxt, After:=ActiveCell,
LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows,
SearchDirection:=xlNext, MatchCase:=False)
If Not rng Is Nothing Then
sh.Activate
' my code here
end if
End with

ErrorHandler:
MsgBox "Please Select One", vbOKOnly, "Error"
End Function

Seeing as how I am a novice Any Input would be Appreciated, and Any
Pointers as well.
thank you!