+ Reply to Thread
Results 1 to 7 of 7

Select cell with Ctrl+G to a specfic column

  1. #1
    Forum Contributor terrypin's Avatar
    Join Date
    01-06-2010
    Location
    East Grinstead, UK
    MS-Off Ver
    MS Office 365
    Posts
    533

    Select cell with Ctrl+G to a specfic column

    If I am in col X of any row, is there some Reference I can enter in the Go To dialog that will select the cell in the current row but in column B? I want to do it programmatically, not manually, for use in an external script.

    Coming at it from a different direction, is there some direct way (apart from VBA) to get the Current Row onto the clipboard (or even just into a specific fixed cell), so that I could then enter 'BRow' as the Go To reference?
    Last edited by terrypin; 02-21-2021 at 12:05 PM.
    Terry, East Grinstead, UK
    Excel 365, Win 10 Pro, i7 PC, 4.0 GHz

  2. #2
    Forum Contributor
    Join Date
    11-20-2007
    Location
    Felixstowe, England
    MS-Off Ver
    Excel 2013, 2019
    Posts
    217

    Re: Select cell with Ctrl+G to a specfic column

    What do you mean by "external script"? Programmatically hints at VBA ... in which case you wouldn't use the Go To dialog ... so you request makes no sense to me.

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Select cell with Ctrl+G to a specfic column

    Hi terry,

    Here is the VBA code that will do what you want.
    Please Login or Register  to view this content.
    Assign this macro to a key combination or put it on the QAT (or both)
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Forum Contributor terrypin's Avatar
    Join Date
    01-06-2010
    Location
    East Grinstead, UK
    MS-Off Ver
    MS Office 365
    Posts
    533

    Re: Select cell with Ctrl+G to a specfic column

    Thanks Marvin. I was hoping to do it without any use of VBA, using only a macro (essentially simulating mouse and key actions) written with Macro Express Pro. But I gave in last night and adopted your solution. I used VBA code I already had, almost identical to yours:

    Please Login or Register  to view this content.
    (I'll change "z1" to your more intuitive "z".)

    I'll also need several further variations, i.e. selecting columns other than B or Z, the two implemented so far. Your approach gives me the basis for that general solution, thank you.

    Adding them to the QAT was not an idea I'd considered for this particular case, because I will be using these small selection tasks as only a small part of MX Pro macros. I've developed a reliable method of triggering such VBA macros from MX Pro: basically telling Excel to run PERSONAL.xlsb!GoToColZ for example.

  5. #5
    Forum Contributor terrypin's Avatar
    Join Date
    01-06-2010
    Location
    East Grinstead, UK
    MS-Off Ver
    MS Office 365
    Posts
    533

    Re: Select cell with Ctrl+G to a specfic column

    Glenn: I'm using a program called Macro Express Pro (MX Pro). It creates 'macros'. To avoid potential ambiguity with Excel VBA macros I used the alternative term 'script'. That's what its macros consist of, written in its Script Editor.

  6. #6
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Select cell with Ctrl+G to a specfic column

    Hi terry,

    I've used Windows Macro programs in the past because I was dealing with multiple and different programs. In Excel you can use "SendKeys" that puts keystrokes in the keyboard buffer, just like typing them in. The problem with SendKeys and Macro programs is timing, and other programs in the way. If you put keystrokes into the buffer before it is ready, as in not in the correct program, things go south very fast. Excel also has DoEvents which will wait for the OS to do other things before continuing.

  7. #7
    Forum Contributor terrypin's Avatar
    Join Date
    01-06-2010
    Location
    East Grinstead, UK
    MS-Off Ver
    MS Office 365
    Posts
    533

    Re: Select cell with Ctrl+G to a specfic column

    Thanks Marvin.

    I haven't yet used either SendKeys or DoEvents in my limited VBA excursions, so I'll read up on them and try some simple examples soon.

    Yes, timing is indeed a pain. It's usually the most likely cause of one of my MX Pro macros failing - usually intermittently, of course!

    One significant advantage that MX Pro has for me (apart from the greater ease of use of its GUI for a non-programmer when creating macros) is the far wider range of activation options. For those that I choose to activate with KB or mouse shortcuts there are thousands of possible combinations, compared with the small 'Ctrl + Shift' repertoire in Excel.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. CTRL+Spacebar not working to select entire column?
    By MetroBOS in forum Excel General
    Replies: 6
    Last Post: 06-15-2023, 07:26 PM
  2. [SOLVED] Navigating using Ctrl + Arrow Keys (Select Specific Empty Cell)
    By sighlent1 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-30-2018, 06:30 PM
  3. Replies: 1
    Last Post: 02-22-2017, 10:04 AM
  4. Replies: 4
    Last Post: 10-21-2010, 11:05 AM
  5. ctrl c and ctrl v breaks a merge cell
    By eg_ckhad in forum Excel General
    Replies: 1
    Last Post: 07-28-2008, 03:32 AM
  6. ctrl c and ctrl v breaks a merge cell
    By eg_ckhad in forum Excel General
    Replies: 1
    Last Post: 07-28-2008, 12:41 AM
  7. [SOLVED] select [a1]cell when hotkey(ctrl+q) pressed, after userform load
    By x taol in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-27-2006, 06:10 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1