ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   spreadsheet control in userform (https://www.excelbanter.com/excel-programming/377403-spreadsheet-control-userform.html)

vipul

spreadsheet control in userform
 
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

ufo_pilot

spreadsheet control in userform
 
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("Searc hThisRange")
Set rngFound = rngToSearch.Find(What:=wks.Range("MatchThisCell"), _
LookAt:=xlPart, MatchCase:=False)
If Not rngFound Is Nothing Then
Worksheets("WorksheetToCopyFrom").Range("RangeToCo piedAndPasted").Copy
rngFound.Offset(0, 1).PasteSpecial xlValues
Else
MsgBox myFind & " was not found"
End If
Range("A1").Select
End Sub

HTH

"vipul" wrote:

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



All times are GMT +1. The time now is 04:27 PM.

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