earldunning
Active Member
- Joined
- Nov 9, 2006
- Messages
- 263
I have code in a sheet (not module). I create the sheet in a new workbook on the fly (within a macro) but want the new sheet to have some functionality. Having code in the copy sheet was a way I could get macros into the new sheet.
The sheet code calls another workbook and opens to a tab. Then I need to search the newly opened workbook and place a value in it.
The problem is, the sheet code does not work beyond opening it and going to the tab. The code works fine in a module but I dont have that luxery at this time.
Any help would be appreciated. Thanks
The sheet code calls another workbook and opens to a tab. Then I need to search the newly opened workbook and place a value in it.
The problem is, the sheet code does not work beyond opening it and going to the tab. The code works fine in a module but I dont have that luxery at this time.
Any help would be appreciated. Thanks
Code:
(this code is inside a sheet - not a module)
Dim ListLength As Long
Dim cntr As Integer
Dim UniqueCRID As Integer
Dim UniqueIDFound As Boolean
Workbooks.Open Password:="release1", Filename:="\\ohlewnas0240.nwie.net\claims\Release Demand Info\Release And Demand Master.xls" 'works
Sheets("ChangeReq").Select 'works
ListLength = Range("A" & Rows.Count).End(xlUp).Row [COLOR="Red"]'doesnt work - picks up sheet info not other workbook[/COLOR]
MsgBox ("ListLength = " & ListLength)
MsgBox ("UniqueID = " & UniqueCRID)
ListLength = 165
cntr = 3
Do While cntr < ListLength + 1 [COLOR="Red"]'doesnt work - searches through sheet not other workbook [/COLOR]
'MsgBox ("addedpoperly is " & AddedProperly & "row is " & cntr)
If Range("A" & cntr) = UniqueCRID Then
UniqueIDFound = True
GoTo 10
End If
cntr = cntr + 1
Loop
Last edited: