Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. -- Regards, Tom Ogilvy "jjordan" wrote: 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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You don't have to select a cell to read the value.
cellvalue = ActiveCell.Offset (0,1).value "Tom Ogilvy" wrote: 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. -- Regards, Tom Ogilvy "jjordan" wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
OFFSET problem | Excel Worksheet Functions | |||
Offset VBA Problem | Excel Discussion (Misc queries) | |||
Problem with an offset | Excel Programming | |||
Offset problem | Excel Programming | |||
Offset Problem | Excel Programming |