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 / March 2006

Tip: Looking for answers? Try searching our database.

Specifing the active cell

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
chortler@fetchmail.co.uk - 23 Mar 2006 15:34 GMT
How can I specify what the activecell is, If I try to select a new
range (see below) this doesn't seem to change the active cell
(according to activecell.rows)

Excel.Sheets("ALLIncidents").Range("A1")

Help???
Andrew Taylor - 23 Mar 2006 17:30 GMT
Your code doesn't select the range - you need to use

Excel.Sheets("ALLIncidents").Range("A1").Select

but first you also have to make sure that "ALLIncidents"
is the active sheet:
Excel.Sheets("ALLIncidents").Active

unless of course you know for certain that it is active - but
better safe than sorry..

As a general rule it's not usually necessary to select cells,
and it tend to make macros run slower (as well as possibly
confusing users by losing their initial selection). Instead
you can do things like:

Dim MyCell as Excel.Range
Set  MyCell = Excel.Sheets("ALLIncidents").Range("A1")
MyCell.Value = "Hello, World!"

Andrew

> How can I specify what the activecell is, If I try to select a new
> range (see below) this doesn't seem to change the active cell
[quoted text clipped - 3 lines]
>
> Help???
 
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.