spreadsheet control in userform

  • Thread starter Thread starter vipul
  • Start date Start date
V

vipul

Hi, I have used a microsoft office spreadsheet 11.0 control in my userform.. All i need is a search from the active sheet, column search, then extract the matching cell row and paste the entire row in the spreadsheet control.

How can I do it. Please give me the code. for multiple results, the sheet shud have all the matching results row in the control.

thanks

EggHeadCafe.com - .NET Developer Portal of Choice
http://www.eggheadcafe.com
 
You will need to tweek this one to your needs.
BTW... at "rngFound.Offset(0, 1).PasteSpecial xlValues"
the row is offset to be pasted one column over

Sub FindCopyPaste()
Dim myFind As Integer
Dim rng As Range
Dim rngToSearch As Range
Dim rngFound As Range
Set wks = ActiveSheet
Set rngToSearch =
Worksheets("NameOfWorksheetToSearch").Range("SearchThisRange")
Set rngFound = rngToSearch.Find(What:=wks.Range("MatchThisCell"), _
LookAt:=xlPart, MatchCase:=False)
If Not rngFound Is Nothing Then
Worksheets("WorksheetToCopyFrom").Range("RangeToCopiedAndPasted").Copy
rngFound.Offset(0, 1).PasteSpecial xlValues
Else
MsgBox myFind & " was not found"
End If
Range("A1").Select
End Sub

HTH
 

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