Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / January 2008

Tip: Looking for answers? Try searching our database.

Find the row

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ant - 28 Jan 2008 19:28 GMT
I have two worksheets one with data and on with a form I would like to find
the row that is selected on the data sheet and use it on the form sheet.

myRow = ActiveWorkbook.Worksheets("Data").ActiveCell.Row

I cannot find a way for this to happen. I have this in a module procedure
which I call when the form sheet is activated.

any help would be greatly appreciated

Anthony
Dave Peterson - 28 Jan 2008 19:56 GMT
The Activecell belongs to a window or the application--not the worksheet.

So one way is to go to that worksheet and look at the activewindow:

   Dim myRow As Long
   Dim ActCell As Range
   Dim CurSel As Range
   
   Application.ScreenUpdating = False
   
   Set CurSel = Selection
   Set ActCell = ActiveCell
   
   Worksheets("sheet2").Select
   myRow = ActiveWindow.ActiveCell.Row
   MsgBox myRow
   
   Application.Goto CurSel
   ActCell.Select
   
   Application.ScreenUpdating = True

> I have two worksheets one with data and on with a form I would like to find
> the row that is selected on the data sheet and use it on the form sheet.
[quoted text clipped - 7 lines]
>
> Anthony

Signature

Dave Peterson

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.