Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ROW BUG

Status
Not open for further replies.

gc1234

Programmer
Mar 4, 2004
94
GB
Hi Yep,

Having a whirl of a time here

I have a tag that i want to get the row number it is on

EndRow

Its at row 22 but its giving row 3776 that another tag with the same name is on.... even though i call AddSt... code below

endAddRow = Worksheets("AddSt").Cells.Find("EndRow", [a1], xlFormulas, xlWhole, xlByRows, xlPrevious).Row

should be 22

gving me 3776, this is valid for Sheet2
 
Hi,

If you want the FIRST occurrence row returned...
Code:
endAddRow = Worksheets("AddSt").Cells.Find("EndRow", [a1]).Row
:)

Skip,

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
So why if i quoted sheet AddSt did it get the value from Sheet2?

I changed the string call then it worked?
 
If you were on the other sheet, the only thing I could surmise is that [a1] referenced the ActiveSheet rather than Worksheets("AddSt")
Code:
endAddRow = Worksheets("AddSt").Cells.Find("EndRow", Worksheets("AddSt").[a1], xlFormulas, xlWhole, xlByRows, xlPrevious).Row
???

Skip,

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
better code...
Code:
With Worksheets("AddSt")
  endAddRow = .Cells.Find("EndRow", .[a1], xlFormulas, xlWhole, xlByRows, xlPrevious).Row
End With


Skip,

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top