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 / Programming / May 2008

Tip: Looking for answers? Try searching our database.

Choosing Active Cell

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
WLMPilot - 23 May 2008 16:38 GMT
I have a worksheet that contains 12 budgets (one for each month).  Each
budget is identical in size (rows & columns).  I have two commandbuttons that
allow me to sort two different ways.  The user simply enters the month
(numeric value 1-12) and that particular budget is sorted.

What I am looking for is an automatic way to determine which budget is being
looked at, ie if I am viewing May's budget, logic would be I would be sorting
May's budget.  I figure if I can determine what cell is currently selected,
then I can determine the range to be sorted automatically without the user
having to enter the month.

What code would determine what cell is selected?

Thanks,
Les
Gary''s Student - 23 May 2008 16:52 GMT
Sub whereami()
MsgBox (ActiveCell.Address)
MsgBox (ActiveSheet.Name)
End Sub

Signature

Gary''s Student - gsnu200788

WLMPilot - 26 May 2008 11:51 GMT
Thanks.  

Les

> Sub whereami()
> MsgBox (ActiveCell.Address)
> MsgBox (ActiveSheet.Name)
> End Sub
Norman Jones - 23 May 2008 16:53 GMT
Hi  Les,

   Dim Rng As Range

   Set Rng = ActiveCelll

   MsgBox Rng.Address(External:=True)

---
Regards.
Norman

>I have a worksheet that contains 12 budgets (one for each month).  Each
> budget is identical in size (rows & columns).  I have two commandbuttons
[quoted text clipped - 15 lines]
> Thanks,
> Les
Norman Jones - 23 May 2008 16:59 GMT
Hi Les,

Slightly over enthusiastic typing:

>    Set Rng = ActiveCelll

should be:

    Set Rng = ActiveCell

---
Regards.
Norman
WLMPilot - 26 May 2008 11:51 GMT
Thanks.  

Les

> Hi Les,
>
[quoted text clipped - 9 lines]
> Regards.
> Norman
 
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.