Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find ComboBox Value In a Excel Column

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Can someone please tell me why this won't work

Sub Find()
msheet = ActiveSheet.Name
Select Case msheet
Case "BoQ"
Range("s:s").Select
Selection.Find(What:=ComboBox1.Text, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
End Select
ActiveCell.Offset(0, -11).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False

End Sub

Please help me!!!!!!
 
You must enter your code in UserForm module, for.ex.:

Private Sub CommandButton1_Click()
' CommandButton1 event procedure
Range("A:A").Select
Selection.Find( _
What:=ComboBox1.Text).Activate
MsgBox ActiveCell.Text
End Sub
 
Hello again guesser!

I've made a few amendments to your code. Is this the same problem(s) you were having before??

Code:
Sub Find()
Dim msheet As String 'added
msheet = ActiveSheet.Name
    Select Case msheet
        Case "BoQ"
            Columns("S:S").Select 'NEW
            Selection.Find(What:=ComboBox1.Text, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
                False).activate 
            ActiveCell.Copy 'need to copy something to paste!!
        End Select
        ActiveCell.Offset(0, -11).Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
        Application.CutCopyMode = False 'ADDED
End Sub

Is the Case select necessary ie are you running different code dependent on active sheet?

I deleted one of the argument from your find so just use what I've posted back.

Happy Friday
it begins tomorrow!
;-) If a man says something and there are no women there to hear him, is he still wrong?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top