Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Find value in a 2nd workbook

I need to search for a value found in one workbook on a second workbook.
Unfortunately, the .Find function seems to find the value in the first
workbook (valuePointLicenses(0).XLS) rather than the one where I want it to
search (SDI_Sales_Alignments_ 022708.xls)

Thanks for the help

Option Explicit
Dim Temp As Long
Dim TempName As Range
Dim LastRow As Long

Sub Copy_Alignments()
Application.Windows("valuePointLicenses(0).XLS").A ctivate
MsgBox ActiveWorkbook.Name
Cells(2, 1).Select
LastRow = Cells.Find(What:="*", After:=[A1], _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row
Temp = ActiveCell.Value
Application.Windows("SDI_Sales_Alignments_ 022708.xls").Activate
MsgBox ActiveWorkbook.Name
With ActiveSheet
MsgBox ActiveCell.Value
Set TempName = Cells.Find(What:=Temp, After:=ActiveCell, LookIn:=xlFormulas,
LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False)
End With
If TempName Is Nothing Then
MsgBox "Not Found"
Else
MsgBox TempName.Address
End If
Windows("valuePointLicenses(0).XLS").Activate
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Find value in a 2nd workbook

I tested this in Excel 2007 and it worked OK. However, in lieu of:-

With ActiveSheet

Try using:-

With ActiveWorkbook.ActiveSheet

--
Regards,

OssieMac


"Rafi" wrote:

I need to search for a value found in one workbook on a second workbook.
Unfortunately, the .Find function seems to find the value in the first
workbook (valuePointLicenses(0).XLS) rather than the one where I want it to
search (SDI_Sales_Alignments_ 022708.xls)

Thanks for the help

Option Explicit
Dim Temp As Long
Dim TempName As Range
Dim LastRow As Long

Sub Copy_Alignments()
Application.Windows("valuePointLicenses(0).XLS").A ctivate
MsgBox ActiveWorkbook.Name
Cells(2, 1).Select
LastRow = Cells.Find(What:="*", After:=[A1], _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row
Temp = ActiveCell.Value
Application.Windows("SDI_Sales_Alignments_ 022708.xls").Activate
MsgBox ActiveWorkbook.Name
With ActiveSheet
MsgBox ActiveCell.Value
Set TempName = Cells.Find(What:=Temp, After:=ActiveCell, LookIn:=xlFormulas,
LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False)
End With
If TempName Is Nothing Then
MsgBox "Not Found"
Else
MsgBox TempName.Address
End If
Windows("valuePointLicenses(0).XLS").Activate
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Find value in a 2nd workbook

OssieMac - Thanks for the quick reply.

Any other thoughts? I have changed With ActiveSheet to With
ActiveWorkbook.ActiveSheet and it still results in a found value on the
original workbook rather than the one which is supposed to be active -
SDI_Sales_Alignments_ 022708.xls

Thanks

"OssieMac" wrote:

I tested this in Excel 2007 and it worked OK. However, in lieu of:-

With ActiveSheet

Try using:-

With ActiveWorkbook.ActiveSheet

--
Regards,

OssieMac


"Rafi" wrote:

I need to search for a value found in one workbook on a second workbook.
Unfortunately, the .Find function seems to find the value in the first
workbook (valuePointLicenses(0).XLS) rather than the one where I want it to
search (SDI_Sales_Alignments_ 022708.xls)

Thanks for the help

Option Explicit
Dim Temp As Long
Dim TempName As Range
Dim LastRow As Long

Sub Copy_Alignments()
Application.Windows("valuePointLicenses(0).XLS").A ctivate
MsgBox ActiveWorkbook.Name
Cells(2, 1).Select
LastRow = Cells.Find(What:="*", After:=[A1], _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row
Temp = ActiveCell.Value
Application.Windows("SDI_Sales_Alignments_ 022708.xls").Activate
MsgBox ActiveWorkbook.Name
With ActiveSheet
MsgBox ActiveCell.Value
Set TempName = Cells.Find(What:=Temp, After:=ActiveCell, LookIn:=xlFormulas,
LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False)
End With
If TempName Is Nothing Then
MsgBox "Not Found"
Else
MsgBox TempName.Address
End If
Windows("valuePointLicenses(0).XLS").Activate
End Sub

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 cell in Excel2000 workbook with link from another workbook? Mark4mmx Excel Discussion (Misc queries) 1 October 8th 08 12:55 PM
Open a specific workbook...find value from other open workbook and then insert cells values in cell next to it. [email protected] Excel Programming 1 May 13th 07 01:46 PM
How can I find value from another workbook Jaan Excel Worksheet Functions 0 November 30th 06 08:50 AM
Find within Workbook. Matt Carter Excel Discussion (Misc queries) 2 August 3rd 05 07:40 PM
Cant find workbook Todd Huttenstine[_2_] Excel Programming 3 December 26th 03 11:47 PM


All times are GMT +1. The time now is 04:49 AM.

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"