J
JCanyoneer
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.
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.