Free Microsoft Excel 2013 Quick Reference

Disable 'enter' key insert

When I am adding tiles to my graphs I need to have two lines in the graph title. When I have data on the clipboard, and press 'enter' to add a return to the graph title, it inserts the clipboard. Can I disable the 'enter' key from inserting data?

Thanks


Post your answer or comment

comments powered by Disqus
Hi there - is it possible to disable users being able to press the enter key on data validation cells? I would like to do that so that they can only select from a list. I have this code (below) and for some reason - if i select cell A5, for example, hit F2 and Enter - it places =NOW in cell W7

But if i just use data validation and select from the data validation list in Cell A5 - it does what its supposed to do

Code:
    If Not Intersect(Target, Range("A5,A8,A11,A14,A17,A20,A23,A26")) Is Nothing Then
        If Target.Value  "Select" Then
            Target.Offset(-1, 22).Value = Now
        Else
            Target.Offset(-1, 22).Value = ""
        End If

End If


I sent my updated sheet to be tested by a user, and found that rather than tabbing between fields, he likes to hit the Enter/Return key. This has the effect of pressing the Submit (commandbutton). Is there a way to either disable the Enter key or set it to have the effect of pressing the Tab key in a user form?

I am hoping to find a way to disable the "reference insertion behavior" of
the PageUp and PageDown keys when editing text cells in Excel.

To phrase it differently, if you are editing data in a cell in Excel, and
then forget to hit enter or tab to exit the cell and commit the changes
before pressing PageUp or PageDown, not only do you lose your changes but you
also lose your orignal text if you don't notice that this has happened before
the undo command becomes unusable.

Does anyone know of a way to alter this behavior? at the very lest for
columns of data that are of type "text"?

Thanks.

My boss is not very computer literate and in order for him to use the
spreadsheet I created for tracking jobs, he "must" be able to insert a row by
hitting the enter key. Basically, he wants to just type on a line, hit
enter, and be on the next line to type something -- like Word does. Any
ideas??

Apparently there are people in my office too lazy to use (learn to use?) filters, so it was requested that I add this functionality to a spreadsheet; it just used the text inserted into a given textbox to activate the associated autofilter. Previously, I was previously using _change() but it was driving me nuts to see the field filter for "2" when entering "29" (for example) so I switched to _lostfocus. Is there any way to additionally update the filter when the enter key is pressed?


	VB:
	
 TextBox1_LostFocus() 
    Dim rlevel As Variant 
    rlevel = ActiveSheet.TextBox1.Value 
    If Not rlevel = "" Then 
        Selection.AutoFilter Field:=7, Criteria1:="" & rlevel 
    End If 
End Sub 

If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines
I would assume that I need to use .OnKey({ENTER},....), but I am not sure how to make this work for only the active textbox.

edit: spelling

Hi All,

I have a Form with 2 passwords on it. After entering the first Password, an OK button is clicked and if the Password is correct, then the Form shifts focus to the next Password Textbox and disables the first. I would like to be able to use EITHER the Mouse Click or the ENTER key on the Keyboard to shift the focus if the first password is correct, but I am having no success. Can anyone help me here please?

Regards,

Bill

In a listbox of item numbers.

I can successfully mouse click any item number in the list and the matching item is selected on the main sheet.

If a keyboard letter key is selected the first of the corresponding item numbers that starts with that letter (if any) is selected and I can continue to scroll through those corresponding item numbers by continuing to press the same letter key.

But…. the enter key will not select the item the same as mouse clicking will.

Is it possible to program the enter key to act the same as a mouse click?

Also, using the keyboard up-down arrow keys will scroll through the items in the list and also select the matching item on the sheet concurrently.

Is it possible to disable the up-down arrows from having any control on my sheet?

Thank you

If I go into Excel 2007...insert textbox...then type 'hello' I can hit the 'enter' key on the main keyboard area and it will go down to the next line BUT if I hit the 'enter' key on the number pad (just off to the right on the say keyboard) it doesn't do anything!
Weird? Can I change this? My users have a hard time adjusting...using differnet 'enter' keys.
* note: both 'enter' keys move to the next line in Excel 2003.

TIA
-Bruce

I'm quite new to VBA, but I'm developing a spreadsheet with a macro. On a worksheet, I have one cell used for entry of a text string. It's a merged cell. The macro returns a result based off of what is entered into that merged cell. The easiest and most common method of entering data into that cell is copying the string onto the clipboard from an outside app. and pasting it into the merged cell. However, upon doing so, the user always gets the message, "Data on the Clipboard is not the same size and shape as the selected area. Do you want to paste the data anyway?" Upon clicking the OK button, the user gets another message, "Cannot change part of a merged cell," and the data is not entered. (First of all is there a way to address this?)
To work around this, I figured I'd just use an activeX textbox control inserted onto the worksheet (a userform is too much for the purposes of this macro and the users who will use it). I can size the textbox to the length it needs to be, and theres not "merged-ness" to overcome. However, when the user strikes the enter key, nothing happens. The cursor just stays there. Isn't the enter key supposed to "enter" the data? (Second, is there a way to fix this?)
I'm guessing i'll have to program some code in the keypress event for the enter key. Well, what do I tell it to do? Losefocus? just execute the macro? copy the textstring to the cells beneath the textbox? Move focus to the worksheet? I'm not sure what to tell excel to do when the enter key is pressed.

Thank you for your help!

Hi, i would like to know how i can disable arrows keys if i select determined range of cells (for example A1:A20), i am asking that because i run macro when somebody change value of this cells automatically and if person press left/right arrow key, macro not work fine, so i would like to arrow lock on this range of cells, its possible ? Thanks

Hello there!

I was wondering, is it possible to execute my VBA sub from textbox1 using the enter key?

Thanks!
PHRoG

Okay, I would like to use the enter key to move to certain cells. I have a worksheet with static information on it. I only need to put information in certain cells. I would like to somehow just hit enter and move to the next cell that I need to input information in. Can this be done and how?

I am running Excel 2000 on XP and for some reason when I am in a spreadsheet and I hit the enter key it moves me up a cell, instead of down. I have no idea how this happened and I have been unable to find an Excek 'help' answer to change this back. A solution to this annoying little problem would be REALLY APPRECIATED. Thanks a lot. Shas

I have an application which uses a variety of different Userforms for input. For the most part, all of the Userforms work OK. On occassion, when the "ENTER KEY" is pressed, focus does not move to the next input box; however, you can set the focus by clicking on the next box with the mouse. There seems to be no rhyme or reason when the program does this, and it only does this intermittently.
I have checked, and re-checked ALL of the Enter key settings for each inut box, as well as the tab orders for each Userform, and all is OK in that regard.
Has anyone else encountered this problem? If so, were you able to track down the cause, and how did you fix it?
Please help........I'm stumped!!!
Thanks in advance
Ted.........
ps. This is a rather large file (2MB)..could it possibly have something to do with memory? I'd be surprised if this is the case as I'm running a 2 gig processor with 512MB of DDR Ram. Also running W2K with Office 2000.

Dear Experts,
I have a textbox in my form and a button to run some code. It takes two steps to use the form: (1) enter the data into the textbox, and (2) click the button.
How can I add an additional way to activate the code by hitting the ENTER key after the data has been entered in the textbox?
Thank you very much in advance.

I often have problems with RefEdit in forms. The various events associated with it don't always seem to fire. The one that really has me baffled though is what happens when the focus is on the RefEdit and the user hits the Enter key? I can't seem to trap this event. For example, the RefEdit exit event doesn't fire. Usually the macro just quits running without going through any event macro that I can find. My enter key default is an OK button, but that doesn't fire.

On a slightly different note, I notice in my list of possible references something called RefEdit. What does it do? It seems to make no difference whether I have it selected or not.

This problem persists over several OS and Excel 97 and 2000.

Any ideas?
Thanks

I have a form, and the form has a textbox. I have a button labeled search, and when it is clicked the macro searches for the information in the text box. How do i make the search action begin when the user press'es the enter key while on the textbox? Thank you!

I know there is probably a very simple solution to this, but I can't figure it out and it is annoying me to no end.

Some option must've changed recently in my excel spreadsheets by accident and now when I hit the enter key it doesn't drop down to cell in the next row, it just stays there. Does anyone know how to fix this?

Thanks so much in advance.

-TPK

Hello. I am working with a large legacy file/program which has a lot of issues. Foremost, and unfortunately this cannot be changed, is that all of the controls were placed directly on the worksheets instead of on Userforms.

The actual code from the legacy file is excessively complicated, so I created this simple example. Sheet1 has one textbox and one command button. Sheet 2 is blank. I want to be able to click the command button or use the Enter key on the command button, to trigger the Click Event. Clicking works fine. When using Enter, if Sheet2.Activate is commented, everything works fine. If Sheet2.Activate is executed, then Excel crashes. Any ideas are greatly appreciated!

Thanks, Tom


	VB:
	
) 
    Dim bBackwards As Boolean 
    Select Case KeyCode 
         'Only look for tab, return, down arrow, up arrow
    Case vbKeyTab, vbKeyReturn, vbKeyDown, vbKeyUp 
        Application.ScreenUpdating = False 
         'Do we need to go back to previous control
        bBackwards = CBool(Shift And 1) Or (KeyCode = vbKeyUp) 
        If bBackwards Then TextBox1.Activate Else CommandButton1.Activate 
        Application.ScreenUpdating = True 
    End Select 
End Sub 
Private Sub CommandButton1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) 
    Dim bBackwards, bForwards As Boolean 
    Select Case KeyCode 
    Case vbKeyTab, vbKeyReturn, vbKeyDown, vbKeyUp 
        Application.ScreenUpdating = False 
        bBackwards = CBool(Shift And 1) Or (KeyCode = vbKeyUp) 
        bForwards = (KeyCode = vbKeyTab) Or (KeyCode = vbKeyDown) 
        If bBackwards Then 
            TextBox1.Activate 
             'Since this is the last control, stay on the button
        ElseIf bForwards Then 
            CommandButton1.Activate 
        Else 
             'Only remaining possibility is Return key
            Call CommandButton1_Click 
        End If 
        Application.ScreenUpdating = True 
    End Select 
End Sub 
Private Sub CommandButton1_Click() 
    Sheet2.Cells(1, 1).Value = "test" 
    Sheet2.Activate 
End Sub 

If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines


hi
I am trying to use the enter key to populate a range with a userform's textbox data.

I have searched around without any luck

cheers
toe

Hi all,

I'm using a form for data entry to a table. However, I have a tendency to hit the enter key without thinking after each field, instead of tabbing through; this means that I keep entering half-completed records by accident. Is there any way to 'switch off' the enter key for forms, so that the only way to add a record is to press the button that I've created for the purpose?

Thanks!

Is There A Way After You Click Off A Cell It Will Hit The Enter Key. I Am Doing A Format Using Data Valadation With Drop Down Menus. Except For The Code I Have Written It Will Not Auto Color The Cell Inless You Press Enter. I Can Not Use Conditional Formatting Becuase I Need More The Three. Please Help And I Can Post An Excel Sheet If Need Be.

Thanks in advance for all your help out here...you all are great!

My question is....is it possible to run a macro after the enter key is hit?

Thanks again.

t

Please Help

I would like to get the multilane text of the control Textbox1 in cell A1

My cod is:

Private Sub UserForm_Initialize()
TextBox1.EnterKeyBehavior = True
TextBox1.MultiLine = True
TextBox1.WordWrap = True
End Sub

Private Sub TextBox1_Change()
Range("A1").Value = TextBox1.Text
End Sub

It works OK, but after each time I press ENTER key to start a new line, in the end of the line in cell A1 it types symbol (or character) look like to Rectangle (in TextBox1 during typing and pressing enter key it is normal, no Rectangle). What I am doing wrong?

Thanks,

Sahak


No luck finding an answer? You could always try Google.