+ Reply to Thread
Results 1 to 7 of 7

VBA code to prevent data entry

  1. #1
    Registered User
    Join Date
    06-25-2009
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    76

    VBA code to prevent data entry

    I want to prevent users from entering data into a column. but if they want to delete a row it should be allowed. How can i do this?

  2. #2
    Registered User
    Join Date
    12-25-2009
    Location
    China
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: VBA code to prevent data entry

    Maybe you can try such Code
    Please Login or Register  to view this content.

  3. #3
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: VBA code to prevent data entry

    No VBA required, if you want to avoid it. Lock the cells of the column, unlock the cells you want to remain editable and then click the Review ribbon - Protect Sheet - tick the "Delete rows" option.

  4. #4
    Forum Expert contaminated's Avatar
    Join Date
    05-07-2009
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2013
    Posts
    1,430

    Re: VBA code to prevent data entry

    U can also set data validation. Select entire column, go to data > validation. select custom from Allow drop-down. type ="" in formula field
    Thus, u can prevent entering any data in column, but allow to delete entire row.

    hi Teylyn. I didn't check, but I dont believe your suggection would work...
    Люди, питающие благие намерения, как раз и становятся чудовищами.

    Regards, ?Born in USSR?
    Vusal M Dadashev

    Baku, Azerbaijan

  5. #5
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: VBA code to prevent data entry

    caught me out there, V. You're right. Thanks for pointing it out.

  6. #6
    Registered User
    Join Date
    06-25-2009
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    76

    Re: VBA code to prevent data entry

    hi thanks its working very well.
    Wanted to know if you can also help me with the following:
    I want to prevent users from entering characters in number fields, and entering incorrect date in date field. the date entered should be converted to DD-MON-YYYY format.
    Last edited by teylyn; 02-04-2010 at 03:42 AM. Reason: link spamming - not relevant to thread

  7. #7
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: VBA code to prevent data entry

    singhabhijitkumar,

    please refrain from posting links to web sites that have no relevance to the nature of your thread.

+ 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