+ Reply to Thread
Results 1 to 10 of 10

Excel Final Touchups - If-Then Checkboxes - Odd lines

  1. #1
    Registered User
    Join Date
    01-24-2018
    Location
    Smyrna, TN
    MS-Off Ver
    2016
    Posts
    12

    Excel Final Touchups - If-Then Checkboxes - Odd lines

    Hello everyone!

    I'm entirely new to excel, but can make common sense out of some code. That being said, I still have no idea what I'm doing because I don't know the "action" commands. I've attached the excel spreadsheet I've been working on, with some help from folks here as well.

    I've only got one VBA code included and that is to require comments on certain values from drop down lists. Now onto my issues:

    - There are vertical dashed lines going through the middle of my data bar cells in columns C, D, E, F. I've read it has something to do with conditional formatting and copying and pasting, but those weren't copy/pasted. How can I fix that?

    - The data bars in columns C, D, E, F are also looking funny. some show full bars in the cell, and others with the same value do not. How can I fix that?

    - When I add cells/checkboxes or other misc things to the work sheet, I get a run time 103 error. I have attached the VBA debug screen shot. Any idea why to get me heading in the right direction?

    - On the VBA code for requiring comments I currently have inserted, when it puts in a comment I used Application.UserName to identify who made the change. How do I make that look more like the original excel method of identifying comment author?

    - And lastly, how do I use an if-then statement on the checkboxes like I did with certain values from the dropdown list to require a comment when box is checked? I would like a "two-stage" comment insert. I want it to automatically insert the Date and Time it was checked, and then ask for text input for 'Reason'.

    Thanks in advance for your help! I definitely couldn't do it without some!
    Attached Images Attached Images
    Attached Files Attached Files

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Excel Final Touchups - If-Then Checkboxes - Odd lines

    Where are you trying to add the check boxes (or do you mean the boxes in columns AN:AP)? You want a comment when the box is checked on. What would you like to happen if the box is checked off? If I could figure out a way to "deactivate" the check box after it is checked so it cannot be unchecked would you like this?

    It looks like part of the solution is to revise the code for the target area that causes the macro to run.

    You are probably correct that the conditional formatting is clobbering the dotted dividers in the cell, but if you insist on using one of the "canned" formats, that's what you will get. I don't think there is a fix for this.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Registered User
    Join Date
    01-24-2018
    Location
    Smyrna, TN
    MS-Off Ver
    2016
    Posts
    12

    Re: Excel Final Touchups - If-Then Checkboxes - Odd lines

    Quote Originally Posted by dflak View Post
    Where are you trying to add the check boxes (or do you mean the boxes in columns AN:AP)? You want a comment when the box is checked on. What would you like to happen if the box is checked off? If I could figure out a way to "deactivate" the check box after it is checked so it cannot be unchecked would you like this?

    It looks like part of the solution is to revise the code for the target area that causes the macro to run.

    You are probably correct that the conditional formatting is clobbering the dotted dividers in the cell, but if you insist on using one of the "canned" formats, that's what you will get. I don't think there is a fix for this.
    dflak,

    Thank you. I am talking about the checkboxes at AN:AP. I want it to force a comment when it is checked true. If it is checked false it could just delete the comment. There will only be a few of us utilizing this workbook, and mistakes happen, so I want them to be able to uncheck the box.

    How do you mean revise for the target area? I don't know anything about vba coding, but am learning basics pretty quickly.

    How else could I format the cells with vertical dashed lines? I learned how to do that little bit watching a youtube video, lol.

  4. #4
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Excel Final Touchups - If-Then Checkboxes - Odd lines

    As for the dashed lines, I'll have to do some experimentation. If it is possible, it will be a custom solution.

    I will work the other issues and when I get it working, I'll explain about the target area.

    I have another observation. The data, as you have it laid out is fixed. How do you plan to add / delete employees? So I am making three suggestions.
    1. Move the totals row to the top of the spreadsheet - this way no matter how many lines of data you have, they won't overwrite or "push" the total line. The data will be "free" to extend as far down as it has to go.
    2. Change the data to an Excel Table instead of just a range. Excel tables have many advantages, but the big two here are:
    - a. Tables know how big they are. So any formulas that reference them will grow or contract with the data.
    - b. Tables automatically copy down formulas, formats, data validations, etc. as new data is added.
    3. The correct way to make a new month is to copy the sheet and rename it - this assures that the code goes along with the sheet.

  5. #5
    Registered User
    Join Date
    01-24-2018
    Location
    Smyrna, TN
    MS-Off Ver
    2016
    Posts
    12

    Re: Excel Final Touchups - If-Then Checkboxes - Odd lines

    Quote Originally Posted by dflak View Post
    As for the dashed lines, I'll have to do some experimentation. If it is possible, it will be a custom solution.

    I will work the other issues and when I get it working, I'll explain about the target area.

    I have another observation. The data, as you have it laid out is fixed. How do you plan to add / delete employees? So I am making three suggestions.
    1. Move the totals row to the top of the spreadsheet - this way no matter how many lines of data you have, they won't overwrite or "push" the total line. The data will be "free" to extend as far down as it has to go.
    2. Change the data to an Excel Table instead of just a range. Excel tables have many advantages, but the big two here are:
    - a. Tables know how big they are. So any formulas that reference them will grow or contract with the data.
    - b. Tables automatically copy down formulas, formats, data validations, etc. as new data is added.
    3. The correct way to make a new month is to copy the sheet and rename it - this assures that the code goes along with the sheet.
    dflak,

    Again, thank you for your input.
    1. That easily done, and probably a good point.
    2. I don't know anything about Excel other than basic spreadsheets. I wouldn't know where to begin with Tables.
    3. That how I usually do, and it's easier.

  6. #6
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Excel Final Touchups - If-Then Checkboxes - Odd lines

    This should get you started with tables. Once you try them, you'll get hooked. http://www.utteraccess.com/wiki/Tables_in_Excel.

  7. #7
    Registered User
    Join Date
    01-24-2018
    Location
    Smyrna, TN
    MS-Off Ver
    2016
    Posts
    12

    Re: Excel Final Touchups - If-Then Checkboxes - Odd lines

    I figured out the data bars and vertical dashed lines. There were odd conditional formats setup. Now really just needing the checkboxes to require comment.

  8. #8
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Excel Final Touchups - If-Then Checkboxes - Odd lines

    Glad you worked that out.

    Here is the prototype. Obviously, it doesn't have your new conditional formatting, so you will have to apply it.

    I dropped the checkboxes. They are exceptionally difficult to work with. First of all, they do not "reproduce" so if you add new people, you have to add new check boxes. Secondly, there are two ways to work with checkboxes: (1) you use their name or (2) you use the cell they are linked to. The second method is somewhat doable, but you would have to link each checkbox to a cell in the table.

    I replaced the checkboxes with simple drop-down Yes/No

    I moved the totals to the top and I also added a row to enter the date and year. These are used in conjunction with the dates in row 4. By knowing the the month and year and day, I can calculate weekends and use conditional formatting to show them.

    So, here is how you can use the sheet.
    1. Make a copy of the template sheet and rename it.
    2. Enter the month name in cell A1 and year in Cell B1
    3. Hide rows for dates that don't exist, like February 29. 30 and 31.

    Clone a sheet and make a month, or play with February. Delete February and re-create it when you are ready for the "real" February.

    You can hide the template sheet after you've cloned all your months.

    In answer to another question you may have: it will take some VBA comb through the cells and pick out the comments for a report.
    Attached Files Attached Files

  9. #9
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Excel Final Touchups - If-Then Checkboxes - Odd lines

    Oh yes, I forgot to tell you about the range.

    I defined two named ranges:
    Date_Range =OFFSET(Template!$G$5,0,0,COUNTA(Template!$A:$A)-3,31)
    Warning_Range =OFFSET(Template!$AL$5,0,0,COUNTA(Template!$A:$A)-3,3)

    This wiki explains named ranges: http://www.utteraccess.com/wiki/Offs...Dynamic_Ranges but essentially the date range is columns G:AK, Row 5 down to the end and the warning range is columns AL:AN from row 5 down to the end.

    Then there is the change event code on the template sheet:

    Please Login or Register  to view this content.
    If you try to change more than one cell at at time (such as a mass copy and paste), the code will fail. This line of code says, if you are changing more than one cell, exit the subroutine, don't try to process the code. You can still do the copy/paste, but nothing else will happen.

    Then we have two sections of code: one to deal with the attendance and the other to deal with the warnings.
    Please Login or Register  to view this content.
    This code says, look at the target (the cell whose contents you just changed). If it is in the range Date_Range, then continue with the code. The intersect command gives the intersection of two or more ranges. If the ranges don't touch each other (such as the changed cell is outside the specified range) then their intersection is nothing. The NOT negates this meaning that do the code if the target is in the range.

    The second block of code does the same thing except for the warning columns.

  10. #10
    Registered User
    Join Date
    01-24-2018
    Location
    Smyrna, TN
    MS-Off Ver
    2016
    Posts
    12

    Re: Excel Final Touchups - If-Then Checkboxes - Odd lines

    dflak,

    Again, thank you so much. You've been a ton of help to me!

+ 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. [SOLVED] Checkboxes to copy different lines to clipboard
    By no_Fate in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-05-2016, 05:02 PM
  2. [SOLVED] Final lines of code are ignored - can't understand why
    By Wedge120 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 01-23-2015, 01:38 PM
  3. Select series(lines) in a line graph by adding userform with checkboxes on a chart
    By aab_489 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-24-2014, 12:25 PM
  4. Creating a Final Estimate Form and a Final Materials List based on Worksheet Results
    By Crunched For Time in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 12-20-2013, 09:58 PM
  5. Lines in final PDF printed document
    By cabinetguy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-21-2012, 10:36 AM
  6. replacing lowest test grade with final if final is higher formula help
    By colbyclay in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 03-16-2012, 02:48 AM
  7. Final tab based on checkboxes
    By billh0918 in forum Excel General
    Replies: 0
    Last Post: 01-20-2012, 11:54 AM

Tags for this Thread

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