Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]() 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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro as multiple use code | New Users to Excel | |||
is there anyway to make it so the users of my excel spread sheet cant view the macro code w/o a password? | Excel Worksheet Functions | |||
Make Change Case in Excel a format rather than formula | Excel Worksheet Functions | |||
macro code shortcut | Excel Worksheet Functions | |||
Zip Code Macro | Excel Worksheet Functions |