ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Find from Textbox and Paste into Cell on sheet one (https://www.excelbanter.com/excel-programming/341912-find-textbox-paste-into-cell-sheet-one.html)

Mark Cover

Find from Textbox and Paste into Cell on sheet one
 
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

JS2004R6

Find from Textbox and Paste into Cell on sheet one
 
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

"Mark Cover" wrote:

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


Mark Cover

Find from Textbox and Paste into Cell on sheet one
 
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

"JS2004R6" wrote:

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

"Mark Cover" wrote:

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



All times are GMT +1. The time now is 11:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com