Find from Textbox and Paste into Cell on sheet one

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need hellp finding data entered in a textbox, and I want to paste the
entire row in sheet1, example:

Form textbox = dog, Click Fiind
a10 = cat, b10 = dog, c10 = monkey

paste all cells in ss # 1.

Thanks for your help
-mark
 
Hi Mark,

I think this should give you something to work with. I used the following:

Form called "frmFind"
Button called "cmdFind"
TextBox called "txtFind"

Hope it helps.
Regards,
James

Private Sub cmdFind_Click()
FindText
End Sub

Sub FindText()
Dim wkb As Workbook
Dim wks1 As Worksheet
Dim wks2 As Worksheet
Dim rng As Range
Dim rngSearch As Range

Set wkb = ThisWorkbook
Set wks1 = wkb.Worksheets("Sheet1")
Set wks2 = wkb.Worksheets("Sheet2")

Application.ScreenUpdating = False
wks2.Select
Set rngSearch = wks2.Range(Cells(10, 1), _
Cells(10, wks2.Range("IV10").End(xlToLeft).Column))

For Each rng In rngSearch
If UCase(rng.Value) = UCase(frmFind.txtFind.Value) Then
rng.EntireRow.Copy
wks1.Select
wks1.Range("A1").PasteSpecial (xlPasteAll)
wks1.Range("A1").Select
Application.CutCopyMode = False
Exit For
End If
Next rng
Application.ScreenUpdating = True

Set wks1 = Nothing
Set wks2 = Nothing
Set wkb = Nothing
MsgBox "DONE"
End Sub
 
Josh, Great reply but this is not working for me. I have tried to play with
it but i am not getting anything to past in sheet1. If you or someone else
can give more info i would appreciate it. Thanks
-mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top