+ Reply to Thread
Results 1 to 24 of 24

How to apply Macro to a cell?

  1. #1
    Registered User
    Join Date
    05-06-2008
    Location
    Chester, England
    MS-Off Ver
    Work: Office 97-03. Home: XP, Office 2010
    Posts
    35

    4 or 5 rules on Conditional Formatting (97-2003 Excel)

    Hi

    I've made a spreadsheet at home on Excel 2007 which has up to 5 Conditional Formatting rules per cell which works fine. The problem is when I save as 97-2003 version to send to work, the old version of Excel only supports 3 rules as you know, is there a way of applying 4 or 5 rules when specific text is populated in a cell on the old version of Excel?

    Many thanks

  2. #2
    Forum Expert
    Join Date
    12-24-2004
    Location
    Sweden
    Posts
    1,256

    Conditional formatting >3 conditions

    There is no easy way:
    Tricks: http://www.mcgimpsey.com/excel/conditional6.html
    Add-ins (I can't reach it now): CFPlus you can read the text from Googles cache though.

    Discussion forum link, http://www.mvps.org/dmcritchie/excel/condfmt.htm

    The next step is paid add-ins, Excel 2007, or change to another spreadsheet supplier.

    //Ola

  3. #3
    Registered User
    Join Date
    05-06-2008
    Location
    Chester, England
    MS-Off Ver
    Work: Office 97-03. Home: XP, Office 2010
    Posts
    35
    Hi Olasa

    Thanks for your reply. Had a look at the link on your post but don't know if I can make that work for me.

    I basically want to add an A, P, L or an E to a cell which would colour the cell and text to match, somebody at work suggested I may be able use a macro which would be triggered by entering the letter in the cell, do you know if that's possible?

    Many thanks

    Greg

  4. #4
    Forum Expert
    Join Date
    12-24-2004
    Location
    Sweden
    Posts
    1,256

    ...

    "I basically want to add an A, P, L or an E to a cell which would colour the cell and text to match"

    You could have a look at this or make a post in the Programming forum.
    VBA/Macros is not my strong side.

    HTH
    Ola


    ...A,P,L,E are 4 conditions. With one as default, 3 could be used.

  5. #5
    Registered User
    Join Date
    05-06-2008
    Location
    Chester, England
    MS-Off Ver
    Work: Office 97-03. Home: XP, Office 2010
    Posts
    35
    Hi, thanks for your post, the link didn't work by the way but thanks.

    I can record the macro but I don't know how to apply it to a cell rather than trigger it via a button. I'll post on the programming forum and see if anyone can help

    Thanks again

    Greg

  6. #6
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320
    link to cfplus now working they must have paid the bill
    http://www.xldynamic.com/source/xld.....Download.html

  7. #7
    Registered User
    Join Date
    05-06-2008
    Location
    Chester, England
    MS-Off Ver
    Work: Office 97-03. Home: XP, Office 2010
    Posts
    35
    Hi

    Thanks for the link, looks like that would do the trick nicely however I don't have access to download and install add-ons in work

    Never mind

    Thanks

    Greg

  8. #8
    Registered User
    Join Date
    05-06-2008
    Location
    Chester, England
    MS-Off Ver
    Work: Office 97-03. Home: XP, Office 2010
    Posts
    35

    How to apply Macro to a cell?

    Hi

    We have Excel 97-03 at work and I have a spreadsheet where I need to apply 5 conditional formatting rules to a cell but obviously can't on the old version of Excel.

    I can't download any add ons as I don't have authority at work so I'm thinking I could run a macro if triggered by an entry in the cell.

    I basically want to be able to enter a specific letter such as A, B or C etc into a cell which will trigger the macro and colour the cell and text to match.

    How can I record a macro so it's triggered by entering a letter in a cell rather than applying a macro to a button?

    Any help would be greatly appreciated

    Thanks

    Greg

  9. #9
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Twaddy,

    Welcome to the forum. Your threads have being merged.
    Please read forum rules below about duplicates posts.

    Post a sample of what your after.

    Is it one cell or a range
    Is it a formula or cell changed by user
    What are the letters and colours
    etc

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  10. #10
    Registered User
    Join Date
    05-06-2008
    Location
    Chester, England
    MS-Off Ver
    Work: Office 97-03. Home: XP, Office 2010
    Posts
    35
    Hi

    Apologies firstly for cross posting, I wasn't aware of the implications however after reading the rules etc on VBA Noob's post I now have a better understanding so thank you.

    I'm looking for a macro to apply to a range of cells which will be updated manually by entering either "A,P,L or E in a particular cell which will then change the colour of the cell and text to either green (A), orange (P), red (L), or yellow (E).

    I know how to record the macro so that the cell and text change colour but I don't know how to trigger the macro by entering the letter in the cell.

    Thanks in advance for any help

    Greg

  11. #11
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    See attached. Change colour index to the shade you require


    Code used
    Please Login or Register  to view this content.
    VBA Noob
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    05-06-2008
    Location
    Chester, England
    MS-Off Ver
    Work: Office 97-03. Home: XP, Office 2010
    Posts
    35
    Hi

    Many thanks for your reply and code, works great, I hadn't thought about using a drop down list but it works well.
    My initial intention was just to key the letter into the cell, would it be difficult if I wanted to apply code so the colour is triggered by keying the letter?

    Can you also advise how I'd change the code so that the text colour matches the cell colour so I end up with a cell which is one colour and I can't see the text letter?

    Thanks again

    Twaddy

  13. #13
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Just remove the data validation and try

    Amended code

    Please Login or Register  to view this content.
    VBA Noob

  14. #14
    Registered User
    Join Date
    05-06-2008
    Location
    Chester, England
    MS-Off Ver
    Work: Office 97-03. Home: XP, Office 2010
    Posts
    35
    Thank you VBA Noob, works a treat, just as I wanted.

    I also need to apply something similar to a range of cells where the text is populated automatically from the following formula =IF(E742<1,"N/A",IF(E742<2,"RTW 1",IF(E742<3,"RTW 2",IF(E742<4,"RTW 3",IF(E742<99,"Well Being")))))

    I need "RTW 1" to be green, "RTW 2" to be Yellow, "RTW 3" to be Orange and "Well Being" to be red.

    I've tried amending the code you wrote however it isn't working, not sure if i'm doing something wrong or whether it's down to the text being populated from a formula.

    Sorry to be a pain but could you advise please, struggling to get my head round it

    Cheers

  15. #15
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    You would need a Worksheet Calculate event as a formula not a change calling the event.
    Something like

    Please Login or Register  to view this content.
    VBA Noob

  16. #16
    Registered User
    Join Date
    05-06-2008
    Location
    Chester, England
    MS-Off Ver
    Work: Office 97-03. Home: XP, Office 2010
    Posts
    35
    I've amend the code so it works for RTW 1, 2 and 3, changing the colour of the cell as required however "Well Being" isn't changing colour. Below is my amended code, would you mind looking over it and advise if there's something which would prevent "Well Being" changing the cell colour?

    HTML Code: 
    Thanks

  17. #17
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    UCase converts to upper case so change to

    Please Login or Register  to view this content.
    VBA Noob

  18. #18
    Registered User
    Join Date
    05-06-2008
    Location
    Chester, England
    MS-Off Ver
    Work: Office 97-03. Home: XP, Office 2010
    Posts
    35
    Brilliant, works perfectly!

    That's all I need for now on this post, thanks for all your help and advice

    Cheers

    Twaddy

  19. #19
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Glad it helped

    You could chage the formula to

    =LOOKUP(E742,{0,1,2,3,4},{"N/A","RTW 1","RTW 2","RTW 3","Well Being"})
    VBA Noob

  20. #20
    Registered User
    Join Date
    05-06-2008
    Location
    Chester, England
    MS-Off Ver
    Work: Office 97-03. Home: XP, Office 2010
    Posts
    35
    Little bit neater and simpler isn't it, thanks.

    Twaddy

  21. #21
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Indeed, Plus it allows for more than 7 conditions.

    VBA Noob

  22. #22
    Registered User
    Join Date
    05-06-2008
    Location
    Chester, England
    MS-Off Ver
    Work: Office 97-03. Home: XP, Office 2010
    Posts
    35
    I'll be honest, I didn't know IF statements were limited to 7 conditions. Someone at work wrote that formula, I'm only just getting to grips with Excel as you can tell

    Cheers

  23. #23
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988

  24. #24
    Registered User
    Join Date
    05-06-2008
    Location
    Chester, England
    MS-Off Ver
    Work: Office 97-03. Home: XP, Office 2010
    Posts
    35

    Smile

    Thanks for the links, think I'll try and keep it under 7!

    Cheers
    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)

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