LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Excel Macro - Find Activecell.value

Gaura215 wrote on 31-07-12 :
Hello

I was trying to google it and checked on forums, but couldnt
successfully found any solution to my problem.

I have a list of names in coloum D of a worksheet called "Trial", I have
another worksheets called "Usage" with this list. I need a macro which
can search the name written in Trial worksheet in Usage and worksheet,
and activate the found results in usage worksheet.

I cannot use vlookup formulae here as "trial" sheet only has last names,
which "usage" sheet has full names.

Please help me, this is an urgent report which I need to make asap.

Regards
Gaurav


=================================
Public Sub Trial_Usage()
Dim RangeArr(1 To 2) As Range, CellFound As Range
Dim i As Long, NameToFind As String

' Definition -------------------------
Set RangeArr(1) = [Trial!D1]
Set RangeArr(2) = [Usage!D1]
NameToFind = InputBox("Name to find")
' ------------------------------------

For i = 1 To 2
Set RangeArr(1) = RangeArr(1).Resize(RangeArr(1).End(xlDown).Row)
Set RangeArr(2) = RangeArr(2).Resize(RangeArr(2).End(xlDown).Row)
Next

With RangeArr(1)
Set CellFound = .Find(What:=NameToFind, _
MatchCase:=False, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, _
LookAt:=xlWhole, _
LookIn:=xlValues)
If CellFound Is Nothing Then
MsgBox NameToFind & " not found in " &
RangeArr(1).Worksheet.Name
Exit Sub
End If
End With

With RangeArr(2)
Set CellFound = .Find(What:=NameToFind, _
MatchCase:=False, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, _
LookAt:=xlPart, _
LookIn:=xlValues)
If CellFound Is Nothing Then
MsgBox NameToFind & " not found in " &
RangeArr(2).Worksheet.Name
Else
RangeArr(2).Worksheet.Activate
CellFound.Select
End If
End With

End Sub
=======================================

Let me know if it works.
Bruno


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How To Find If The ActiveCell Is Protected FARAZ QURESHI Excel Discussion (Misc queries) 7 April 13th 09 05:03 PM
HOW TO FIND last cell from activecell? CAPTGNVR[_2_] Excel Programming 5 March 21st 08 02:42 PM
Find ActiveCell.column LindaMac Excel Programming 4 November 10th 04 05:48 PM
Use of Selection.Find & ActiveCell Steve Slechta[_2_] Excel Programming 4 November 19th 03 02:07 PM
selecting a cell relative to activecell in an excel macro Zogann Excel Programming 1 October 17th 03 12:20 PM


All times are GMT +1. The time now is 04:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"