+ Reply to Thread
Results 1 to 14 of 14

VBA lock column if count is greater than 10%

  1. #1
    Registered User
    Join Date
    12-18-2012
    Location
    india
    MS-Off Ver
    Excel 2003
    Posts
    47

    VBA lock column if count is greater than 10%

    Hi All,

    I want to make an attendance sheet. I have a column as 'Name' and rest of the columns has date as their header.
    Now for each day some one will mark "AL","P" or "H". I want to count those AL and if the count is greater than 10% of total head count no one should be allowed to enter any "AL" in that column.An error would pop up. This goes for all the columns.

    The data set is like the one below:

    Name | 01-Mar-2017 | 02-Mar-2017| 03-Mar-2017|......... so on

    Any help is appreciated.
    Thanks

  2. #2
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: VBA lock column if count is greater than 10%

    A sample workbook would help us help you.
    This way, we don't have to build a sheet that could end up not exactly as yours and all the work will have to be redone.
    Pierre Leclerc
    _______________________________________________________

    If you like the help you got,
    Click on the STAR "Add reputation" icon at the bottom.

  3. #3
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,199

    Re: VBA lock column if count is greater than 10%

    Would very much like to see this one play out....Have very little knowledge of WorkSheet Change Event

  4. #4
    Registered User
    Join Date
    12-18-2012
    Location
    india
    MS-Off Ver
    Excel 2003
    Posts
    47

    Re: VBA lock column if count is greater than 10%

    Hi Leclerc, I understand and would have loved to upload a workbook but due to security issues I can not upload any files.
    Can you please help.?

    Thanks

  5. #5
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,199

    Re: VBA lock column if count is greater than 10%

    Can use this as an example I'm sure
    So what OP is trying to achieve, i assume is as follows....
    In Column A there is a list of Peoples names
    In colB or colC or colD etc they have to put a text of either "P" "H" or "AL"
    If they want to Type in "AL" and the count of "AL"'s in the column is more than 10% of the Amount of peoples names then a Message should pop up.
    Attached Files Attached Files
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  6. #6
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: VBA lock column if count is greater than 10%

    put this macro at the sheet level in your VBE.
    You must realise that you need at least 10 employees to be able to enter one AL.
    It will work in any column but you can add restriction if you want to.
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    12-18-2012
    Location
    india
    MS-Off Ver
    Excel 2003
    Posts
    47

    Re: VBA lock column if count is greater than 10%

    Hi Sintek,Thanks for your reply. I did not find any code in the file attached.

    "If they want to Type in "AL" and the count of "AL"'s in the column is more than 10% of the Amount of peoples names then a Message should pop up. "
    If they want to Type in "AL" and the count of "AL"'s in the column is more than 10% of the Amount of peoples names then a error should pop-up PLUS no more AL should be allowed to be entered in that column.

    Thanks.

  8. #8
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,199

    Re: VBA lock column if count is greater than 10%

    There was no code...this was a sample workbook for others to make use of since you did not post 1

  9. #9
    Registered User
    Join Date
    12-18-2012
    Location
    india
    MS-Off Ver
    Excel 2003
    Posts
    47

    Re: VBA lock column if count is greater than 10%

    Hi p24leclerc, it does exactly what I thought but I can't enter AL at once-menas selecting cell typing AL and cnt+enter,it throws an error.
    Further,can I mail that portion of AL data as the error pops up on crossing 10%

  10. #10
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: VBA lock column if count is greater than 10%

    Sorry, I don't understand what you mean.
    Can you explain some more, please?

  11. #11
    Registered User
    Join Date
    12-18-2012
    Location
    india
    MS-Off Ver
    Excel 2003
    Posts
    47

    Re: VBA lock column if count is greater than 10%

    I meant, when the message box pops up (you code does that) and the user click cancel/close button a mail would be sent with all the data marked as AL in that column pasted on the body of the mail.

    Can you please help here too

  12. #12
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: VBA lock column if count is greater than 10%

    no sorry, I can't help you with emails. You should start a new thread for this. You'll have a better chance to get an answer that way.

  13. #13
    Forum Expert
    Join Date
    04-01-2013
    Location
    East Auckland
    MS-Off Ver
    Excel 365
    Posts
    1,343

    Re: VBA lock column if count is greater than 10%

    FWIW If you want to help yourself with email macros there is quite a bit of information on this site

    https://www.rondebruin.nl/win/s1/outlook/bmail2.htm
    If you want something done right... find a forum and ask an online expert.

    Time flies like an arrow. Fruit flies like a banana.

  14. #14
    Registered User
    Join Date
    12-18-2012
    Location
    india
    MS-Off Ver
    Excel 2003
    Posts
    47

    Re: VBA lock column if count is greater than 10%

    Hi scottiex, tahnks for the link,I already went throught it but what I want is mailing the current range in the active column where the user is supplying the data in...this I am not getting.
    Can you help

+ 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. Replies: 6
    Last Post: 02-15-2016, 04:17 PM
  2. [SOLVED] count column with numbers greater than zero
    By rowneyg in forum Excel General
    Replies: 5
    Last Post: 04-20-2015, 09:03 AM
  3. Replies: 7
    Last Post: 12-05-2014, 09:33 AM
  4. [SOLVED] count values greater 2 or greater in a column.
    By ammartino44 in forum Excel General
    Replies: 3
    Last Post: 09-16-2014, 07:05 PM
  5. Forumla for a count greater than 1 in a column
    By doctork11 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-29-2013, 01:15 PM
  6. [SOLVED] Trying to count cells greater than # in one column if another column meets criteria
    By lorne17 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-14-2012, 07:01 PM
  7. [SOLVED] How to count the number of times column B is greater than column A
    By scorpiogirl in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-06-2012, 02:40 AM

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