+ Reply to Thread
Results 1 to 57 of 57

formula VBA by color

  1. #1
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    formula VBA by color

    The code below works great until I try to add a formula. Would someone be willing to help out with this as I can not seem to fix it? Thank you.

    This is what I am trying to do:
    STEP 7: If column J2:J in Low Coverage is Pink then add all and place the value in a new column L on Low Coverage called “Sanger Regions”. If column J2:J in Low Coverage is Yellow then sum of all the yellow and in a new column L on Low Coverage called “New Regions”

    Please Login or Register  to view this content.
    get an Application-defined or object-defined error and the

    Code:
    sh3.Range("L2").Formula = "=SUM(J2:J)/.Interior.ColorIndex = 7"
    is highlighted. Thanks.

  2. #2
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: formula VBA by color

    I have no idea what you want to do with the .interior.colorindex = 7 (There is not even a With structure in your code??)

    You could try something along the lines of this to sum the range:

    Please Login or Register  to view this content.
    Regards,
    Rudi

  3. #3
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: formula VBA by color

    Please Login or Register  to view this content.
    Method Range of Object Worksheet failed erorr 1004. Thanks.

  4. #4
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: formula VBA by color

    The code I posted was just an idea that you could follow or test.
    It is impossible for me to assist with correcting your code if I don't have a sample file you review and test on.
    Is there a chance to upload a sample file with dummy data and a sheet that clearly illustrates a before and after of what you want to achieve.

    TX

  5. #5
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: formula VBA by color

    I attached the spreadsheet. The seven steps are below and steps 1-3 are working as expected, and steps4-7 are where I need help. I figured it would be easier to look at each step individualy so the formula step is what I attempted (with no luck). The spreadsheet called Low Coverage which is the data as of now and a sheet called desired output which is hopefully, going to be the final. Thank you very much for your help.

    STEP 1: Highlight in Red amplicons in Template that do not meet criteria.
    STEP 2: If the value in D2:D is “” THEN ignore (If Range("D2:D").value = "" Then)
    STEP 3: Match column D2:D in Template if it is highlighted Red with column D2:D in Source.
    STEP 4: If there is a match in a new sheet (Low Coverage) all the information in columns A,B,C,D,E,F,G,H,I,J from Source put in there and if it highlighted Red in Template but not in Source
    STEP 5: If the D2:D column in Template highlighted Red is not in Source then the information from columns A,B,C,D,E,H,I,J is put in Low Coverage columns A-H.
    STEP 6: Match column D2:D in Template if it is highlighted Red with column D2:D in Source AND If in Column J in Source there is a Y then column J in Low Coverage is Pink, if in Column J in Source there is a N then column J in Low Coverage is Y Green, if in Column J in Source there is “” then column J in Low Coverage is Yellow with a ? in it
    STEP 7: If column J2:J in Low Coverage is Pink then add all and place the value in a new column L on Low Coverage called “Sanger Regions”. If column J2:J in Low Coverage is Yellow then sum of all the yellow and in a new column L on Low Coverage called “New Regions”.
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: formula VBA by color

    Hi,

    If you are going to have a "Y" and "N" in the cells, you can more easily sum up the value in the cell instead of the colour.
    See this example...
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: formula VBA by color

    Thank you for correcting the formula. I have not been able to figure out why only 4 records (not the complete 61) appear in Low Coverage. I am sure I am missing something but do not know what. Thanks.

  8. #8
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: formula VBA by color

    I'll look into that next

  9. #9
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: formula VBA by color

    I see you are comparing:

    sh1 row 1 with sh2 row 1
    sh1 row 2 with sh2 row 2
    sh1 row 2 with sh2 row 3
    sh1 row 4 with sh2 row 4
    sh1 row ... with sh2 row ...

    should that not compare: (As in a loop IN a loop)

    sh1 row 1 with sh2 row 1
    sh1 row 1 with sh2 row 2
    sh1 row 1 with sh2 row 3
    sh1 row 1 with sh2 row 4
    sh1 row 1 with sh2 row ...
    sh1 row 2 with sh2 row 1
    sh1 row 2 with sh2 row 2
    sh1 row 2 with sh2 row 3
    sh1 row 2 with sh2 row 4
    sh1 row 2 with sh2 row ...

    Is this the case or is you code intended to compare ONLY row 1 with row 1, etc?

  10. #10
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: formula VBA by color

    I think the loop in a loop option is what might help as that will look for the value highlighted in Red in sh2 row 1 in all of sh1, is that correct? Also, if the search value is not in sh1 then the information in sh2 appears in sh3 (Low Coverage).

    For example, AMPL5146333977 is highlighted Red in sh2 (Template), but is not in sh1 (Source). The information in columns A,B,C,D,E,H,I,J in Template appear in Low Coverage with a ? highlighted in Blue in column M "New Regions". Thank you for your help, I appreciate it.
    Last edited by cmccabe; 04-19-2014 at 12:55 PM.

  11. #11
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: formula VBA by color

    Hi,

    See if this does what you need....
    Attached Files Attached Files

  12. #12
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: formula VBA by color

    It's very close, but some of the #'s seem off and it lookslike column I in "Low Coverage" got removed. Thank you.
    Attached Files Attached Files

  13. #13
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: formula VBA by color

    The columns match between your Desired Output and the Low Coverage? Which column I are you referring to?

    If you could work your way through the code that I updated and inform me what part needs to change or what it still needs to do, then I can make those modifications as needed.

  14. #14
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: formula VBA by color

    I must have put the incorrect desired output in there. The Low Coverage is edited with thecorrect values and "?" for the amplicons not in Red. Also, the N should be Y and the Y should be N. The colors are right as is. Thank you.
    Attached Files Attached Files

  15. #15
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: formula VBA by color

    There is no "?" in the original Source Sheet so I'm unsure how to apply here. The code is filtering and simply copying the matching content to the Low Coverage sheet. I'd recommend to step through the code and verify the actions...

    I have made updates to the code.
    Attached.
    Attached Files Attached Files

  16. #16
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: formula VBA by color

    I will take a look at it tomorrow and get back to you.... have a great Easter and thank you.

  17. #17
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: formula VBA by color

    Yes...TX
    Have a good Easter weekend too

  18. #18
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: formula VBA by color

    It looks like only the first 64 records in template are being used to search. Below are the steps for the desired output. The cells that are highlighted Red in "Template" sh2, are used to search "Source", sh1. There are 61 highlighted Red in Template. I think the calculations are not working because of this. Thank you very much, I hope you had a nice Easter.

    STEP 3: Match column D2:D in Template if it is highlighted Red with column D2:D in Source.
    STEP 4: If there is a match in a new sheet (Low Coverage) all the information in columns A,B,C,D,E,F,G,H,I,J from Source put in there and if it highlighted Red in Template but not in Source
    STEP 5: If the D2:D column in Template highlighted Red is not in Source then the information from columns A,B,C,D,E,H,I,J is put in Low Coverage columns A-H.
    Attached Files Attached Files

  19. #19
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: formula VBA by color

    TX for the feedback.
    I'll look into this tomorrow. Off the bed soon

  20. #20
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: formula VBA by color

    Thank you .

  21. #21
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: formula VBA by color

    OK....lets try it now
    Attached Files Attached Files

  22. #22
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: formula VBA by color

    This line should color the amplicons not in source turqoise with a ?, is that correct?

    Please Login or Register  to view this content.
    Thank you for the amazing code , I appreciate all your help.

  23. #23
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: formula VBA by color

    I hope I'm correct in assuming that the change should be on the Low Coverage sheet.

    Try this updated code that also applies the turquoise and the "?".
    Attached Files Attached Files

  24. #24
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: formula VBA by color

    You were correct and thank you very much. To count the ? the below code doesnt seem to be correct. Thank you again very much .

    Please Login or Register  to view this content.

  25. #25
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: formula VBA by color

    A question mark is actually a wildcard character. So it ends up counting EVERYTHING.
    To force Excel to evaluate it as a standard character and not a wildcard, use this code below:
    The tilde sign converts the wildcard to a standard character.

    Please Login or Register  to view this content.

  26. #26
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: formula VBA by color

    Thank you for all your help!

  27. #27
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: formula VBA by color

    My pleasure

  28. #28
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: formula VBA by color

    I removed columns columns 7,8,9 from the Source and the calculations are off. I can not seem to fix it. Thank you.
    Attached Files Attached Files

  29. #29
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: formula VBA by color

    I figured out the calculation, now I am just trying to figure out why column f and h have values in them in the Low Coverage, but only for those cells that are ? in turqoise. Thanks again for all your help .
    Attached Files Attached Files

  30. #30
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: formula VBA by color

    Try it now...
    Attached Files Attached Files

  31. #31
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: formula VBA by color

    Thanks again

  32. #32
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: formula VBA by color

    Any time
    Cheers

  33. #33
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: formula VBA by color

    Hello RudiS, I wanted to ask if you could tell me if this was possible or not as you were so helpful with my last question.

    I am using the multi-step code below and am having trouble on the last few steps. Currently, the VBA will classify, highlight according to the classification, and create 2 new sheets based off of a value. Is there a way to copy and paste specific highlighted rows from the main sheet (annovar), to one off the two newly created sheets? The two new sheets are depended on the value in A2 and get text Known or Unknown put after them. Thank you very much.

    The code below runs up until the last step, in an attempt to accomplish the copy and paste (transfer classification) step there is a code, but it doesn't seem to work. Since the new sheets are dependent on the value in A2 I am not sure how to code that. I need some expert help. Thanks .

    Copy and paste from annovar to TestName Known:
    Dark Red ‘9
    Magenta ‘7
    Blue ‘5
    Cyan ‘8

    Copy and paste to TestName Unknown:
    Yellow ‘6
    Pink ‘22
    Purple ‘21

    Above is the general and a specific example would be:
    In the attached workbook row 4 in annovar is dark red, so the entire row would be copied to TestName Known.
    In the attached workbook row 5 in annovar is yellow, so the entire row would be copied to TestName Unknown.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  34. #34
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: formula VBA by color

    Hi,

    Try this:

    Replace your current "transfer Classifications" code with this code below.
    Note: I am not sure if you were also needing the rows placed on sheets based on the relativity of the value of cell A2? IOW, if cell A2 was named: Test2, would it have to copy the rows to sheets called: Test2 Known and Test2 Unknown? (Assuming that sheets with those names would exist?)
    Please Login or Register  to view this content.
    Last edited by RudiS; 05-17-2014 at 03:34 AM.

  35. #35
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: formula VBA by color

    The code runs but the two worksheets are blank. The two new sheets are based off of the value in A2 in annovar (the sheetname). So if that value is Frank Smith, 1 worksheet (Frank Smith Known) and another worksheet (Frank Smith Unknown) is created. The highlighted rows are copied to the appropriate sheet depending on color in the sheet annovar. The value in A2 the next will be a different name (Bill Walker), so Bill Walker Known and Bill Walker Unknown will be created. The annovar sheet is still there and serves as the common template and will always be. That is were the highlighting is that have the rows to copy. Thank you for your help again.
    Last edited by cmccabe; 05-19-2014 at 10:35 AM.

  36. #36
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: formula VBA by color

    Hi,

    This should work since it takes into account the variable sheet names.
    Replace the previous code part with the part below...

    Please Login or Register  to view this content.

  37. #37
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: formula VBA by color

    Hi,

    The newly created worksheets are empty. In the attached workbook I have copied the desired results. Annovar is the master template that contains the highlighted rows to copy to the sheets. I hope this helps and thank you .
    Attached Files Attached Files

  38. #38
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: formula VBA by color

    Hi,

    Your loop that you had was exiting the sub prematurely.
    I have removed the whole loop process to create the sheets and replaced it with a more linear approach. Since it does not exit the sub it runs the data transfers now too.

    Attached...
    Attached Files Attached Files

  39. #39
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: formula VBA by color

    Perfect.... is there a way to output the data in a particular order and copy the row headers in row 3 onto the sheets? Thank you.

    Copy and paste from annovar to TestName Known:

    Dark Red ‘9
    Magenta ‘7
    Blue ‘5
    Cyan ‘8

    Copy and paste to TestName Unknown:
    Yellow ‘6
    Pink ‘22
    Purple ‘21

    Thanks.
    Last edited by cmccabe; 05-19-2014 at 03:40 PM.

  40. #40
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: formula VBA by color

    Hi,

    Updated....
    Attached Files Attached Files

  41. #41
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: formula VBA by color

    The code runs, but the row headers do not transfer.

    Application-defined or user-defined error:

    ActiveSheet.Range(ActiveSheet.Range("A1").End(xlToRight).Offset(0, 1), ActiveSheet.Rows(1).Cells(Rows(1).Cells.Count)).EntireColumn.Clear (highlighted). Thanks.

  42. #42
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: formula VBA by color

    Nevermind, I copied the code incorrectly. Thank you very much again for all your help .

  43. #43
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: formula VBA by color

    I changed the sheet a bit and am having an error that I am having trouble with:

    The line that is highlighted is:
    Please Login or Register  to view this content.
    and the error is Application or Object Defined

    I'm not sure how to fix it and instead of using the value in A2, I am using a concatenated value in CA1.

    If you run the classify macro and select 1 from the dropdown in A2, you will see the error.

    It appears the code is until it tries to sort and clean the data (VB in the calculations). Thank you .
    Attached Files Attached Files

  44. #44
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: formula VBA by color

    I'll take a look.......

  45. #45
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: formula VBA by color

    Here is the run through...
    Please Login or Register  to view this content.
    The first line selects the appropriate sheet.
    In the sample workbook, this sheet is blank, which causes the next line to debug due to the following part of the code:
    >> Range(ActiveSheet.Range("CA1").End(xlToRight).Offset(0, 1)
    On the "blank" ActiveSheet, it references cell CA1, then moves .End(xlToRight) which takes it to the extreme right cell in row 1 (cell: XFD1)
    Then is Offsets 0 rows up/down and 1 column to the right. So moving 1 cell right while in cell XFD1, will cause an error because there is no cells left to move to.

    This is an explanation of why the code is debugging.
    As for a fix, I wouldn't know what to do as I don't understand the context of the code, or the makeup of the sheet it is supposed to run on. I assume the sheet should not be blank since the code ends with a command to clear the entire column.

  46. #46
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: formula VBA by color

    I attached the workbook that I modified the code from.

    What is supposed to happen:
    1. the data is reformatted (classify macro)
    2. a data validation dropdown is put in A2 (classify macro)
    3. the values in C2 and B2(Last Name,First Name) are concatenated in cell CA1
    4. the inheritance is selected based upon the vlookup
    5. a series of classifications highlight the rows in the spreadsheet and populate the classification column based on rules
    6. two new sheets are created using the CA1 value (Smith,Mark Known) and Smith,Mark Unknown)
    7. the highlighted rows are sorted and transferred to the appropriate sheet
    8. if possible a save as prompt asks the user to save the entire workbook to a given directory they browse to.

    Steps 1-4 work, it is steps 5-8 that I am not sure about. Thank you
    Attached Files Attached Files

  47. #47
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: formula VBA by color

    Sorry for the delay in posting.
    I got side-tracked with an urgent work issue!

    I have fixed the lines that were debugging by adjusting the code to simulate what it did in the TestBook. But I still am not sure of the context of the example workbook as the structures have drastically changed between the two. Anyways, the lines that were initially causing the issue were not critical lines...they were simple cleaning up the sheet and sorting the lines based on the colours. This has been rectified in the example workbook now.

    BTW: I also added the save as prompt as requested....
    Attached Files Attached Files

  48. #48
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: formula VBA by color

    No worries, I hope everything is ok. Is there a way to have the rows highlighted and then sorted based on there classification in the apropriate sheet? The TestBook spreadsheet had that as part of the VBA. Thanks .

  49. #49
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: formula VBA by color

    The example workbook makes no sense to me. It is way different than the original Testbook that was originally used. There is not even a classification column in the example workbook and if these are groups, what colours need to be assigned.

    Please remember that I just see data. I am not familiar to this info and wouldn't know where to start or what to look for.
    If you need anything done on this new file, you will need to spell it out step for step.

    Its getting late here...so I am off to bed now

    BTW: I could recommend that you start a new thread if you would like to get faster answers from a wider group. I am not always available as much as I would like to be and I wouldn't want you waiting for days between my visits here on the board.

    Cheers.

  50. #50
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: formula VBA by color

    Thanks for your help ... I started a new post:

    http://www.excelforum.com/excel-prog...ml#post3770387

    After the claassify macro is run classification appears in column AT. Thanks again.

  51. #51
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: formula VBA by color

    Hi,

    I have been tampering around and comparing code between the example file and the Testmacro file and made some changes...
    Try it now and see if things are looking better.
    Attached Files Attached Files

  52. #52
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: formula VBA by color

    The likely benign and likly pathogenic seem to be working, but the other conditions are not. I modified the code in classify to clean the data up a bit (resize and rename some of the fields).

    1. After the workbook is saved (result) can the annovar sheet in the example- be cleared (this way the user does not have to manually clear it before processing a new data set), if the workbook is not saved then annovar is not cleared.

    2. In the saved (result) can the panel sheet be deleted so that the file size is smaller

    Thank you for all your help, I really appreciate it .
    Attached Files Attached Files
    Last edited by cmccabe; 07-17-2014 at 11:11 AM.

  53. #53
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: formula VBA by color

    Hi,

    I updated the save process to remove the panel sheet from the new saved version
    You will receive a prompt to clear the annovar sheet when you open the example- workbook

    The code will work fine regarding the assignment of colour of categories, as long as the ClinVar/Classifications columns on the annovar sheet get values. Currently there are no values in those columns so no groupings are done.
    Attached Files Attached Files

  54. #54
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: formula VBA by color

    I am not sure where the clear code is, but it works great. Is it possible if the user clears the data that new data is automatically imported? The data will alsways be from the path: C:\Users\cmccabe\Desktop\annovar but the filenames will be variable. The files will always end in ".avinput.hg19_multianno" and are a .txt file. I attached an example file. Essentislly what I do now is open up that file as an excel document and copy it into the annovar tab (that file will be at C:\Users\cmccabe\Desktop\annovar\NGS_Classification.xlsm). Not every step will have data in it, but depending on the step filled out will ultimately lead to some text in Classification and the row highlighted a particular color. Each step in the code is basically an if statement and if there is no value in it moves to the next statement. In the TestBook this seemed to happen, but since the columns changed it is different.I hope this makes sense. Have a great weekend and thanks for all your help .
    Attached Files Attached Files
    Last edited by cmccabe; 07-18-2014 at 02:52 PM.

  55. #55
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: formula VBA by color

    This version will also import data into the annovar sheet from a txt file at a browsed location....
    Attached Files Attached Files

  56. #56
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: formula VBA by color

    Perfect, thank you. I can not figure out why the highlighting in TestBook (attached) is different. In that workbook the coloring was as expected and I do not know what changed. Not every step will have data in it, but depending on the step filled out will ultimately lead to some text in Classification and the row highlighted a particular color. Each step in the code is basically an if statement and if there is no value in it moves to the next statement. In the TestBook this seemed to happen, but since the columns changed it is different. Have a great day and thanks for all your help.

    There are 4 steps that will result in text and highlighting in classification:

    clinvar
    AD or AR inheritance
    common
    gender

    It gets kinda messy and difficult to explain, but I hope this helps.
    Attached Files Attached Files

  57. #57
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: formula VBA by color

    I have some questions to see if they are possible:

    1. Can sheet panel and annovar be removed from the newly saved workbook, but with the calculations still working (as of now w/o panel a #REF error happens)
    2. Can the clear new data be disabled on the newly saved workbook
    3. Can the data be sized to row 1 on the newly created workbooks
    4. Can all highlighting In after AU2 be removed as well as the text in CA1-CF1
    5. Can the newly saved workbook have macros disabled or be saved as an xlsx

    Thank you .
    Attached Files Attached Files

+ 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: 4
    Last Post: 12-29-2013, 11:41 PM
  2. Strikethrough using a formula? Change font color using formula?
    By Mike Biz in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-20-2013, 01:35 PM
  3. color formula
    By wd8ekd in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-20-2008, 12:40 PM
  4. Changing Formula Color NOT cell Color in Formula Bar
    By Lucas1234 in forum Excel General
    Replies: 6
    Last Post: 07-29-2008, 10:07 AM
  5. Formula which changes color
    By the dude in forum Excel General
    Replies: 1
    Last Post: 06-01-2006, 05:20 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