Hotkey for Select a word -> CTRL-C -> TAB -> CTRL-V

HarrySiers

Board Regular
Joined
May 27, 2015
Messages
61
Hello Forumers,

Is it possible to make a hotkey that does the following in a cell:

Select the current word (the word on which the cursor is positioned) by doubleclicking it -> cut the word (CTRL-C) -> jump to the next cell in the same row -> paste the word (CTRL-V) ?

Thank you in advance,
Harry
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
What's the number of the word?
1st, 2nd,3rd .... etc
Because no code to select words in excel
 
Upvote 0
Hello Forumers,

Is it possible to make a hotkey that does the following in a cell:

Select the current word (the word on which the cursor is positioned) by doubleclicking it -> cut the word (CTRL-C) -> jump to the next cell in the same row -> paste the word (CTRL-V) ?

Thank you in advance,
Harry

If you have the cursor on a word within a cell, that means you are in Cell Edit Mode. Macros cannot run while the user is in cell edit mode.
 
Upvote 0
What's the number of the word?
1st, 2nd,3rd .... etc
Because no code to select words in excel

For instance the first word, or the second, or the third, etc. If there would be code for it, maybe I could deduct how to change the code to select-cut-paste the word on position [n], n being variable. Thank you in advance, it would be great if it is possible in Excel.

Harry
 
Upvote 0
The code below will return the 4th word in cell B4.

Code:
[color=darkblue]Sub[/color] FINDIT()
    [color=darkblue]Dim[/color] arr, Source [color=darkblue]As[/color] Range, Position [color=darkblue]As[/color] [color=darkblue]Long[/color], Findword [color=darkblue]As[/color] [color=darkblue]String[/color], Xcount [color=darkblue]As[/color] [color=darkblue]Long[/color]
    [color=darkblue]Set[/color] Source = Range("B4")
    Position = [COLOR="#FF0000"][B]4[/B][/COLOR]
    arr = VBA.Split(Source, " ")
    Xcount = [color=darkblue]UBound[/color](arr)
    [color=darkblue]If[/color] Xcount < 1 [color=darkblue]Or[/color] (Position - 1) > Xcount [color=darkblue]Or[/color] Position < 0 [color=darkblue]Then[/color]
        Findword = ""
    [color=darkblue]Else[/color]
        Findword = arr(Position - 1)
    [color=darkblue]End[/color] [color=darkblue]If[/color]
    MsgBox Findword
[color=darkblue]End[/color] [color=darkblue]Sub[/color]
 
Last edited:
Upvote 0
The code below will return the 4th word in cell B4.

Code:
[COLOR=darkblue]Sub[/COLOR] FINDIT()
    [COLOR=darkblue]Dim[/COLOR] arr, Source [COLOR=darkblue]As[/COLOR] Range, Position [COLOR=darkblue]As[/COLOR] [COLOR=darkblue]Long[/COLOR], Findword [COLOR=darkblue]As[/COLOR] [COLOR=darkblue]String[/COLOR], Xcount [COLOR=darkblue]As[/COLOR] [COLOR=darkblue]Long[/COLOR]
    [COLOR=darkblue]Set[/COLOR] Source = Range("B4")
    Position = [COLOR=#FF0000][B]4[/B][/COLOR]
    arr = VBA.Split(Source, " ")
    Xcount = [COLOR=darkblue]UBound[/COLOR](arr)
    [COLOR=darkblue]If[/COLOR] Xcount < 1 [COLOR=darkblue]Or[/COLOR] (Position - 1) > Xcount [COLOR=darkblue]Or[/COLOR] Position < 0 [COLOR=darkblue]Then[/COLOR]
        Findword = ""
    [COLOR=darkblue]Else[/COLOR]
        Findword = arr(Position - 1)
    [COLOR=darkblue]End[/COLOR] [COLOR=darkblue]If[/COLOR]
    MsgBox Findword
[COLOR=darkblue]End[/COLOR] [COLOR=darkblue]Sub[/COLOR]

Thanks a lot, MARK858, it does indeed show the 4th word in a pop up screen. However, is it possible not only to show the word in a pop up screen but also to have it pasted in a particular cell?

Harry
 
Last edited:
Upvote 0
The messagebox was just there to show the test result. Findword is just a string and so assign to a cell like you would any other text.

Range("B5").Value = Findword
 
Upvote 0

Forum statistics

Threads
1,202,909
Messages
6,052,495
Members
444,587
Latest member
ezza59

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top