LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 536
Default Find the correct sheet then find a value on that sheet


This code, in sheet 1 module, searches the other sheets for a date in cell A1. When found then that sheet's A1 is activated by the Application.Goto RngD, True.

What I am having trouble with is, now that I have the correct sheet I want to GoTo a value on that sheet that is listed from C5: to however many rows there may be. (I assume the GoTo A1 is not needed as the code that finds the Column C value will have a GoTo.)

I have tried a Set RngS = .Find(What:=FindStore, _etc. following the
Set RngD = .Find(What:=FindDate, _ but I get an Improper Call error.

So find the sheet that has the Range("D8").Value and once there find the Cell in Column C that has the Range("D4").Value and GoTO it.

Thanks.
Howard


Option Explicit

Sub SearchAOne()
Dim FindDate As String
Dim FindStore As String 'Dimmed but not used yet
Dim RngD As Range
Dim RngS As Range 'Dimmed but not used yet
Dim ws As Worksheet
Dim cnt As Integer
cnt = 0
FindStore = Range("D4").Value 'Dimmed but not used yet
FindDate = Range("D8").Value

If Trim(FindDate) < "" Then
For Each ws In Worksheets
With ws.Range("A1")
Set RngD = .Find(What:=FindDate, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not RngD Is Nothing Then
Application.Goto RngD, True
cnt = 1
End If
End With
Next ws
If cnt < 1 Then
MsgBox "Nothing Found!"
End If
End If

End Sub
 
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 value from one sheet and replace value in second sheet JohnM Excel Programming 3 August 25th 09 04:01 PM
macro to find data from one sheet & copy in another sheet Eddy Stan Excel Programming 6 November 29th 08 11:40 AM
Find value in sheet 1 and copy matching row from sheet 2 Also Excel Programming 1 January 8th 08 11:49 AM
Find value from sheet 1 on sheet 2 and copy to an offset from there L. Howard Kittle Excel Programming 3 March 2nd 07 09:32 PM
how to find and copy values on sheet 2, based on a list on sheet 1 evanmacnz Excel Programming 4 February 7th 05 08:33 PM


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