ChiTownGBM
IS-IT--Management
Hi all,
I need to create a function that will take a value and search a range for that value and then copy all of the data on row to a location.
I found this code on the MSDN website:
Sub FindIt()
Dim rng As Range
' Find data and use Resize property to copy range.
Set rng = Range("A1:A12").Find(What:="Jun", _
LookAt:=xlWhole, LookIn:=xlValues)
If rng Is Nothing Then
MsgBox "Data not found"
Exit Sub
Else
rng.Resize(1, 3).Copy Destination:=Range("G1")
End If
End Sub
More can be found at:
I'd basically like to turn that VB script into a function where I can pass the value to search for, the range to search for. The starting cell for copying the row of data, if found can be the current cell.
Thanx for your help. :-
I need to create a function that will take a value and search a range for that value and then copy all of the data on row to a location.
I found this code on the MSDN website:
Sub FindIt()
Dim rng As Range
' Find data and use Resize property to copy range.
Set rng = Range("A1:A12").Find(What:="Jun", _
LookAt:=xlWhole, LookIn:=xlValues)
If rng Is Nothing Then
MsgBox "Data not found"
Exit Sub
Else
rng.Resize(1, 3).Copy Destination:=Range("G1")
End If
End Sub
More can be found at:
I'd basically like to turn that VB script into a function where I can pass the value to search for, the range to search for. The starting cell for copying the row of data, if found can be the current cell.
Thanx for your help. :-