Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-11-2014, 11:16 PM
htieK htieK is offline Code to send cursor to predefined cell Windows 7 32bit Code to send cursor to predefined cell Office 2010 32bit
Novice
Code to send cursor to predefined cell
 
Join Date: Oct 2014
Posts: 9
htieK is on a distinguished road
Default Code worked - thanks.

Thanks Whatsup, your code worked. It did take me a while to get to it but yes, its almost doing what I want. The only issue is if I leave the cell without entering a value, the code doesn't do anything. I'm realising I was a little too literal in my original question. I'd like the code to respond "leaving the cell" rather than "entering a value into the cell".



Are you able to help with that one?

Many thanks for your help.
Reply With Quote
  #2  
Old 11-12-2014, 03:42 AM
whatsup whatsup is offline Code to send cursor to predefined cell Windows 7 64bit Code to send cursor to predefined cell Office 2010 32bit
Competent Performer
 
Join Date: May 2014
Posts: 137
whatsup will become famous soon enough
Default

Htiek, then you will need a construct like this with a public variable:
Code:
Option Explicit
Private blnJump As Boolean
 
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If blnJump Then
        Range("G11").Select
        blnJump = False
    End If
    If Not Intersect(Target, Range("K12")) Is Nothing Then
        blnJump = True
    End If
End Sub
The code sets blnJump to True once you enter K12. You can either change K12 or leave it unchanged. Leaving K12 will trigger the event again, and will select G11 setting blnJump to False.
The disadvantage: SelectionChange is triggered all the time with selecting a cell within the sheet (though it won't happen anything unless you select K12). Personally I stay away from such events, but I can't think of another possibility.
Reply With Quote
Reply

Tags
send cursor, vba code



Similar Threads
Thread Thread Starter Forum Replies Last Post
Code to send cursor to predefined cell VBA code to select one word from a text in a cell and place that word in next cell Shinaj Excel 2 05-01-2014 01:50 PM
Macro code should find inv no in folder and send attachhed mail. visha_1984 Outlook 0 01-30-2013 05:08 AM
Displaying cursor position within cell MiamiTom Excel 0 11-18-2011 09:02 AM
Code to send cursor to predefined cell Code for Changing Cell Backgrounds leroytrolley Excel 2 12-05-2008 02:05 AM
Code to send cursor to predefined cell code to save / rename / send attachments unit213 Outlook 1 09-26-2007 08:15 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:10 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft