LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
RPTZ
 
Posts: n/a
Default Macro Code minor alteration please.


I was shown a code and I think it was misunderstood.
Not sure how to slighty modify the part of the code to do a search.

It was suppose to search for the value in Sheet1 A1 ( fixed location)
in Sheet 2 "anywhere"

So if the macro is running and it reaches the point to find the value
of Sheet 1 A1, then Select Sheet 2, find the same value anywhere in
Sheet 2, and then select that cell.
From there I have the rest covered after the End If

The code I was shown looks like this:
-----------------------------------------------

Sub Find_First()
Dim FindString As String
Dim Rng As Range
FindString = InputBox("Enter a Search value")

If Trim(FindString) < "" Then
Set Rng = Range("A:A").find(What:=FindString, _
After:=Range("A" & Rows.Count), _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Rng Is Nothing Then
Application.Goto Rng, True
Else
MsgBox "Nothing found"
End If
End If
End Sub ( or continue with the rest of the macro)

But the misunderstanding was where it shows;

FindString = InputBox("Enter a Search value")

This means it has to be typed in. There is no need to type in the
value, it is always in the same location.
It changes value, is when the macro was activated before anyway.

How can I then make that piece of macro code, go to Sheet 2 and locate
the same value as in Sheet 1 A1 without requireinf to type in a value
?

Much appreciated


--
RPTZ
------------------------------------------------------------------------
RPTZ's Profile: http://www.excelforum.com/member.php...o&userid=24896
View this thread: http://www.excelforum.com/showthread...hreadid=384329

 
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
Macro as multiple use code Bruce Neylon New Users to Excel 6 June 29th 05 06:11 PM
is there anyway to make it so the users of my excel spread sheet cant view the macro code w/o a password? Daniel Excel Worksheet Functions 2 June 28th 05 05:34 AM
Make Change Case in Excel a format rather than formula Kevin Excel Worksheet Functions 1 March 18th 05 08:53 PM
macro code shortcut Brian Excel Worksheet Functions 4 December 15th 04 08:59 PM
Zip Code Macro Ken Wright Excel Worksheet Functions 0 December 9th 04 07:55 AM


All times are GMT +1. The time now is 09:56 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"