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: 56
Default Finding data in another workbook

I have an excel file that I plan to put a button in which will open another
excel file and find certain items in the new file but am having some
problems. Here is the code I have:

Dim Row As Byte, Item As String, Item2 As String, LR1 As Long, LR2 As Long
Dim destWB As Workbook

If Range("D" & Row) = 1 Then
Item = "Beacons"
Do
Item2 = destWB.Worksheets("Sheet1").Range("E" &
LR2).Value
LR2 = LR2 - 1
Loop Until Item2 = Item
destWB.Worksheets("Sheet1").Range("J" & LR2) =
destWB.Worksheets("Sheet1").Range("J" & LR2) + 2
End if

I keep getting a Run Time error 1004-Application Defined or Object Defined
Error on the line-Item2 = destWB.Worksheets("Sheet1").Range("E" & LR2).Value

Is there a better way to write this?
I want LR2 to be the row number on the code-opened worksheet in which cell E
& LR2 (where LR2 is the looped variable.) is identical to either Item or a
cell on the current workbook. I can make the latter happen but this part of
the code requires me to set Item's value in the code. Thank you in advance
for any insight.
 
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
Finding a Workbook based on a Cell information in another Workbook Walter Excel Worksheet Functions 1 October 10th 09 08:46 AM
Finding error messages in a workbook bengamboni Excel Programming 2 July 20th 05 07:59 AM
finding all link, hyperlinks in a workbook Michele Excel Discussion (Misc queries) 2 July 11th 05 02:12 PM
Finding out if subroutines exist in another workbook Erich Neuwirth Excel Programming 1 May 24th 04 08:35 AM
Finding duplicate value in another workbook morry[_3_] Excel Programming 4 February 11th 04 10:27 PM


All times are GMT +1. The time now is 06:34 AM.

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

About Us

"It's about Microsoft Excel"