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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling ActiveCell.Row from a form

Status
Not open for further replies.

Bluejay07

Programmer
Mar 9, 2007
780
CA
Hello,

Here's my situation.
In worksheet "A", I click a certain cell which opens a form. When I'm done with the form, I want to determine which row the worksheet it was on before the form opened.

This method fails:
'Worksheets("A").ActiveCell.Row' returns a runtime error (438 - Object doesn't support this property or method).

This method works:
'Application.ActiveCell.Row'

Would using Application... be the best way to handle this and why wouldn't calling the sheet by it's name not work?

Thanks.



If at first you don't succeed, then sky diving wasn't meant for you!
 

When you activate your form, store the row.

The procedure you run in your form may active orher sheets or select other cells, making the statement error.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Thanks for the quick response Skip.
In this case I only have one active sheet and testing was done in the immediate window for both cases. SQL queries will be processed, although there should not be any other sheet become active. Also, I thought of storing the row value, however, I have been advised against it since excel sometimes 'looses' the stored value. I've seen this happen a few times.



If at first you don't succeed, then sky diving wasn't meant for you!
 
If you want a warm fuzzy, store the row in a cell on a sheet.

I usually avoid using any ActiveWHATEVER property.

Rather use a explicit reference.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Thanks again for the advise.
Also Congrats on being named the most helpful a little while ago.

If at first you don't succeed, then sky diving wasn't meant for you!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top