#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 77
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 77
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 77
Default 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
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
Find & Replace and Find & Insert macro help needed RS Excel Programming 2 January 29th 07 07:35 AM
Get Macro warning, but can't find Macro Stilla Excel Worksheet Functions 1 January 20th 07 01:27 AM
change error message when no more for "find" in macro to find swyltm Excel Programming 1 January 13th 06 05:16 PM
I need to find a macro to find data cut and paste to another colu. Rex Excel Programming 6 December 7th 04 09:22 AM
Can't find a macro Bob Potts Excel Programming 2 December 10th 03 07:02 PM


All times are GMT +1. The time now is 11:43 PM.

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

About Us

"It's about Microsoft Excel"