Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
FIND Macro
Hi
Code Needed to do this from a macro, Sheet1 cell A1, the value in this cell changes. How can I get the content of this cell and put it in a Find Macro, Then goto Sheet2 Column A, and find down that column for what was in sheet1 A1. the value in sheet1 A1 changes sometimes. Thanks in advance Dave |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
FIND Macro
what columns are you searching on sheet2, all of them? this is similar to what i
posted to another question. just change the ranges and sheet names. Sub test() Dim ws As Worksheet, ws2 As Worksheet Dim rngfound As Range Dim rng As Range Dim toFind As String Set ws = Worksheets("Sheet1") Set ws2 = Worksheets("Sheet2") Set rng = ws2.Range("A1:A30") toFind = ws.Range("A1").Value With rng Set rngfound = .Find(toFind, lookat:=xlWhole, LookIn:=xlValues) End With If Not rngfound Is Nothing Then Application.Goto ws2.Range("A" & rngfound.Row), scroll:=True End If End Sub -- Gary "DaveM" wrote in message . uk... Hi Code Needed to do this from a macro, Sheet1 cell A1, the value in this cell changes. How can I get the content of this cell and put it in a Find Macro, Then goto Sheet2 Column A, and find down that column for what was in sheet1 A1. the value in sheet1 A1 changes sometimes. Thanks in advance Dave |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
FIND Macro
Hi Gary thanks for the reply
I need to find in sheet2 Column A Thanks Dave "Gary Keramidas" <GKeramidasATmsn.com wrote in message ... what columns are you searching on sheet2, all of them? this is similar to what i posted to another question. just change the ranges and sheet names. Sub test() Dim ws As Worksheet, ws2 As Worksheet Dim rngfound As Range Dim rng As Range Dim toFind As String Set ws = Worksheets("Sheet1") Set ws2 = Worksheets("Sheet2") Set rng = ws2.Range("A1:A30") toFind = ws.Range("A1").Value With rng Set rngfound = .Find(toFind, lookat:=xlWhole, LookIn:=xlValues) End With If Not rngfound Is Nothing Then Application.Goto ws2.Range("A" & rngfound.Row), scroll:=True End If End Sub -- Gary "DaveM" wrote in message . uk... Hi Code Needed to do this from a macro, Sheet1 cell A1, the value in this cell changes. How can I get the content of this cell and put it in a Find Macro, Then goto Sheet2 Column A, and find down that column for what was in sheet1 A1. the value in sheet1 A1 changes sometimes. Thanks in advance Dave |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
FIND Macro
adapt this to your needs
Sub test() Dim ws As Worksheet, ws2 As Worksheet Dim rngfound As Range Dim rng As Range Dim toFind As String Set ws = Worksheets("Sheet1") Set ws2 = Worksheets("Sheet2") Set rng = ws2.Columns("A:A") toFind = ws.Range("A1").Value With rng Set rngfound = .Find(toFind, lookat:=xlWhole, LookIn:=xlValues) End With If Not rngfound Is Nothing Then Application.Goto ws2.Range("A" & rngfound.Row), scroll:=True End If End Sub -- Gary "DaveM" wrote in message . uk... Hi Gary thanks for the reply I need to find in sheet2 Column A Thanks Dave "Gary Keramidas" <GKeramidasATmsn.com wrote in message ... what columns are you searching on sheet2, all of them? this is similar to what i posted to another question. just change the ranges and sheet names. Sub test() Dim ws As Worksheet, ws2 As Worksheet Dim rngfound As Range Dim rng As Range Dim toFind As String Set ws = Worksheets("Sheet1") Set ws2 = Worksheets("Sheet2") Set rng = ws2.Range("A1:A30") toFind = ws.Range("A1").Value With rng Set rngfound = .Find(toFind, lookat:=xlWhole, LookIn:=xlValues) End With If Not rngfound Is Nothing Then Application.Goto ws2.Range("A" & rngfound.Row), scroll:=True End If End Sub -- Gary "DaveM" wrote in message . uk... Hi Code Needed to do this from a macro, Sheet1 cell A1, the value in this cell changes. How can I get the content of this cell and put it in a Find Macro, Then goto Sheet2 Column A, and find down that column for what was in sheet1 A1. the value in sheet1 A1 changes sometimes. Thanks in advance Dave |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
FIND Macro
Works great
Thanks Gary All the Best Dave "Gary Keramidas" <GKeramidasATmsn.com wrote in message ... adapt this to your needs Sub test() Dim ws As Worksheet, ws2 As Worksheet Dim rngfound As Range Dim rng As Range Dim toFind As String Set ws = Worksheets("Sheet1") Set ws2 = Worksheets("Sheet2") Set rng = ws2.Columns("A:A") toFind = ws.Range("A1").Value With rng Set rngfound = .Find(toFind, lookat:=xlWhole, LookIn:=xlValues) End With If Not rngfound Is Nothing Then Application.Goto ws2.Range("A" & rngfound.Row), scroll:=True End If End Sub -- Gary "DaveM" wrote in message . uk... Hi Gary thanks for the reply I need to find in sheet2 Column A Thanks Dave "Gary Keramidas" <GKeramidasATmsn.com wrote in message ... what columns are you searching on sheet2, all of them? this is similar to what i posted to another question. just change the ranges and sheet names. Sub test() Dim ws As Worksheet, ws2 As Worksheet Dim rngfound As Range Dim rng As Range Dim toFind As String Set ws = Worksheets("Sheet1") Set ws2 = Worksheets("Sheet2") Set rng = ws2.Range("A1:A30") toFind = ws.Range("A1").Value With rng Set rngfound = .Find(toFind, lookat:=xlWhole, LookIn:=xlValues) End With If Not rngfound Is Nothing Then Application.Goto ws2.Range("A" & rngfound.Row), scroll:=True End If End Sub -- Gary "DaveM" wrote in message . uk... Hi Code Needed to do this from a macro, Sheet1 cell A1, the value in this cell changes. How can I get the content of this cell and put it in a Find Macro, Then goto Sheet2 Column A, and find down that column for what was in sheet1 A1. the value in sheet1 A1 changes sometimes. Thanks in advance Dave |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Find & Replace and Find & Insert macro help needed | Excel Programming | |||
Get Macro warning, but can't find Macro | Excel Worksheet Functions | |||
change error message when no more for "find" in macro to find | Excel Programming | |||
I need to find a macro to find data cut and paste to another colu. | Excel Programming | |||
Can't find a macro | Excel Programming |