+ Reply to Thread
Results 1 to 12 of 12

disable digit into a cell

  1. #1
    Registered User
    Join Date
    11-26-2010
    Location
    Italia
    MS-Off Ver
    Excel 2003
    Posts
    20

    disable digit into a cell

    Hi,
    Into a range(A1:E1) I've a validate control from list (2,4,6,8). it's possible tu disable the imput from keyboard??
    The users can insert value into a cell only with select-list.
    thank
    Fabrizio

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,318

    Re: disable digit into a cell

    Ciao Fabrizio,

    How are you validating the input of 2, 4, 6, 8? You can do this in VBA or you could add data validation and in the source, only allow 2, 4, 6, 8. This way the user selects the drop down and these are the only choices.
    HTH
    Regards, Jeff

  3. #3
    Registered User
    Join Date
    11-26-2010
    Location
    Italia
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: disable digit into a cell

    Ciao Jeff, (ciao is better that Hi..)
    the second, with Selection.Validation.
    The control play also if the user write from keyboard, but unother control(Worksheet_Change) don't run.
    I want to force the users tu use the mouse (select list).
    I think this is one solution to my last post "use Intersect()"

    fabrizio

  4. #4
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,318

    Re: disable digit into a cell

    Si Fabirizio, Ciao e molto bene,

    Is this question the same as your other post Problem with Intersect(Target)?

    First thought, I don't think it is a good idea to take the keyboard away from the user nor do I believe, in my limited VBA experience, can you limit non-keyboard usage to just a few cells. I'm may be off, but just don't know how.

    Second, my suggestion would be to use the data validation. Highlight A1:E1 >> apply data validation >> Allow: List >> Source: 2, 4, 6, 8 >> You can set an error if the user trys to manually input anything else.

    http://www.contextures.com/xlDataVal01.html

  5. #5
    Registered User
    Join Date
    11-26-2010
    Location
    Italia
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: disable digit into a cell

    Yes/No,
    I try tu use my control (old post) and it play with enter imput or with select (from data validation), but not go if I imput the value and play arrow down.
    For this i thought to block keyboard...

    I use data validation every day, I know that.
    Fabrizio

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

    Re: disable digit into a cell

    OK - try this event code in cell A1.
    Please Login or Register  to view this content.
    here is the attached with that code.

    There is not a VBA way to "block keyboard". Look in the Object Browser for the word Key and see...
    Attached Files Attached Files
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  7. #7
    Registered User
    Join Date
    11-26-2010
    Location
    Italia
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: disable digit into a cell

    Ciao Marvin,
    the problem is my control.
    Thi is my file:
    Try to select for each Seven dwarfs, the same day of holiday.
    If you use the select list (associate at Selection.Validation) 1th ok, 2th ok, and 3th will be non able!!
    try more with keyboard, 1-2-3-4- all are ready to go to holiday...
    Cartel1.xlsm

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

    Re: disable digit into a cell

    Sorry,

    I don't understand the problem. We need some translation help here.

  9. #9
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,318

    Re: disable digit into a cell

    @Marvin,

    If somehow I could get ahold of my friend in Padova, IT I would, but alas, not happening.

    @Fabrizio,

    With your attached spreadsheet, in D6 and E 6 I enter a 4, but then in F6 when entering a 4 you get the waring about holidays. Can you give a little clearer detail here on what you do want to happen and what you do not want to happen.

  10. #10
    Registered User
    Join Date
    11-26-2010
    Location
    Italia
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: disable digit into a cell

    Jeff,
    the two value is the hour of holiday (4 for half day, 8 for all worked day)
    if D6, and E6 value are already compiled, nobody can go in holiday in the same day.
    You've also tryed tu use the keyboard??

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

    Re: disable digit into a cell

    Could this problem really be: Only allow a total of 8 hours per row? If a value is entered that makes the row total greater than 8 it is blanked out?

  12. #12
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: disable digit into a cell

    basic code to block the keyboard
    Please Login or Register  to view this content.
    you could implement this with a selectionchange event but make sure that you use a beforeclose event to reinstate the keyboard! also be aware that it blocks the keyboard for all applications and not just excel (you can change that by specifying a threadid in the last argument of the setwindowshookex call).

    I'm not sure I would recommend this in an excel application but that's your call. ;-)
    Josie

    if at first you don't succeed try doing it the way your wife told you to

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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