Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Cursor skip over a cell


Help. Working on some simple sheet VBA code to:

(1) skip over a cell from the cell above using enter, tab, or arrow
and

(2) skip over a cell from the cell below using the up arrow

I have the following code that works from above:

'SECTION TO JUMP FROM CELL F16 TO G 19 (skip F17:G18)
If Target.Address = "$F$17:$G$18" Then Target(3, 2).Select


Can someone help me add the code to skip cells F17:G18 when I up arrow
from the cell below? Thanks, mikeburg


--
mikeburg
------------------------------------------------------------------------
mikeburg's Profile: http://www.excelforum.com/member.php...o&userid=24581
View this thread: http://www.excelforum.com/showthread...hreadid=473427

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Cursor skip over a cell

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
' Skips over range F17:G17 if moved into from directly above or directly below
' static variable used to keep track of where we moved from:
Static CameFrom As String
' Check to see if we moved into the designated range
If Not (Intersect(Target, Range("F17:G18")) Is Nothing) Then
' Now check to see where we came from:
Select Case CameFrom
Case "$F$16", "$G$16"
Range("G19").Select ' if from cells above, move below
Case "$F$19", "$G$19"
Range("F16").Select ' if from cells below, move above
End Select
CameFrom = Selection.Address
Else
CameFrom = Target.Cells(1, 1).Address
End If
' Note how CameFrom is reset toward the end of the sub to
' keep use the new selection as CameFrom next time we move
End Sub

--
- K Dales


"mikeburg" wrote:


Help. Working on some simple sheet VBA code to:

(1) skip over a cell from the cell above using enter, tab, or arrow
and

(2) skip over a cell from the cell below using the up arrow

I have the following code that works from above:

'SECTION TO JUMP FROM CELL F16 TO G 19 (skip F17:G18)
If Target.Address = "$F$17:$G$18" Then Target(3, 2).Select


Can someone help me add the code to skip cells F17:G18 when I up arrow
from the cell below? Thanks, mikeburg


--
mikeburg
------------------------------------------------------------------------
mikeburg's Profile: http://www.excelforum.com/member.php...o&userid=24581
View this thread: http://www.excelforum.com/showthread...hreadid=473427


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Cursor skip over a cell


Works great! Thank you. mikebur

--
mikebur
-----------------------------------------------------------------------
mikeburg's Profile: http://www.excelforum.com/member.php...fo&userid=2458
View this thread: http://www.excelforum.com/showthread.php?threadid=47342

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
why does my tab key skip to next page instead of next cell rb.jr Excel Discussion (Misc queries) 2 September 29th 09 10:19 PM
Skip cell if X nonexistent, populate next cell prodeji Excel Discussion (Misc queries) 0 February 1st 07 03:51 PM
skip to next cell if no value is found AirCav Excel Discussion (Misc queries) 0 February 9th 06 05:46 PM
Skip a cell that contains data slowdiver Excel Worksheet Functions 1 January 22nd 06 02:38 PM
Skip a cell scottnshelly[_35_] Excel Programming 3 May 29th 04 02:47 AM


All times are GMT +1. The time now is 08:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"