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 2007

Tip: Looking for answers? Try searching our database.

offset problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jjordan - 24 May 2007 13:32 GMT
Good Morning!

Newbie here getting tired of the fight!  I'm having a problem with  
attempting to offset 1 cell to the right.  

I've created a Loop Until statement based on a selectionchange, with If..
Then.. statement enclosed within the loop.  My "Then" statements instructs a
value to be inserted in the cell to the right upon SelectionChange.  This
part works well, however the curser remains in the cell where it just enter
the "Then" text.  I want the curser to move one more cell to the right so the
user can continue with their data entry.

When I add "ActiveCell.Offset (0,1).select" either within the loop statement
or after it, my curser jumps WAY over (e.g. from column "H" to something like
"IU".  A little excessive in my opinion!

I'm sure the computer is doing exactly what I'm telling it to do, however
that is not what I want it to do :)

Any help would be appreciated.

JJ
Tom Ogilvy - 24 May 2007 13:46 GMT
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On error goto Errhandler
Application.EnableEvents = False

' your current code

errhandler:
Application.EnableEvents = True
End Sub

you are recursively calling the selectionchange event by changing the
selection within the event.

this should fix it.  

Signature

Regards,
Tom Ogilvy

> Good Morning!
>
[quoted text clipped - 18 lines]
>
> JJ
Joel - 24 May 2007 13:50 GMT
You don't have to select a cell to read the value.

cellvalue = ActiveCell.Offset (0,1).value

> Private Sub Worksheet_SelectionChange(ByVal Target As Range)
> On error goto Errhandler
[quoted text clipped - 33 lines]
> >
> > JJ
 
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.