+ Reply to Thread
Results 1 to 8 of 8

Need help inserting new code

  1. #1
    Registered User
    Join Date
    03-10-2019
    Location
    United States
    MS-Off Ver
    Office 365
    Posts
    31

    Need help inserting new code

    Hello , I have a situation, I have already a code that inserts all the formulas I want and it works great, what I want to do now is to apply color to the row from G to L where the value on J is "Play the dog" or "Play the Favorite", the code I was trying to use was this

    now here is the code for inserting formulas that I am using
    Please Login or Register  to view this content.
    So now here is the issue , with the code above I wanted to use the values on colum J , so if the value is "Play the Dog" apply certain color, if the value is "Play the favorite" apply certain color, the code I was trying to use is the one below on the sub applycolorforCFB
    but when I run the code below it doesn't apply the color , I have use the watch window to look at this part of the code
    Please Login or Register  to view this content.
    just to make sure that the values are changing to the corresponding values on each row , and it does show on the Watch window that when the code goes on each cell under column J it shows the value "Play the Favorirte" or "No Play" or "Play the Dog" . But the color is not been apply, any thoughts why?
    And what do I need to do to apply the color?


    Please Login or Register  to view this content.

  2. #2
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Need help inserting new code

    .
    Your macro for coloring the cell interior works fine. Tested it here.

    You can do one of two things to have the color show ... created a commandbutton that is attached to your "applycolorforCFB" macro. When that button
    is clicked, the color will be shown.

    Insert the name of your macro in each of the first two macro, just above the END SUB line :

    applycolorforCFB
    End Sub


    After the main sub is run, it will "call" the applycolorforCFB sub. This method does not require the addition of another command button as outlined above.

  3. #3
    Registered User
    Join Date
    03-10-2019
    Location
    United States
    MS-Off Ver
    Office 365
    Posts
    31

    Re: Need help inserting new code

    ok I created the button and assigned the sub applycolorCFB to it , press it and didn't apply the color, ok , could it be that I have created the macro on a separate module, but if it's on another module by creating the button and assigning the macro to the button it should work, but it's not yet.

  4. #4
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Need help inserting new code

    .
    Are either of those terms in the column ?

  5. #5
    Registered User
    Join Date
    03-10-2019
    Location
    United States
    MS-Off Ver
    Office 365
    Posts
    31

    Re: Need help inserting new code

    yes they are but here is the issue , the value comes after a formula , in other words on column J I have this formula that determines the value =IFS(I6>0,"Play the favorite",I6<0,"Play the Dog",I6=0,"No Play") , this is in the VBA code and the results are posted in each cell , what I am trying to do is use the value from the result of the formula. and apply the color sub.

  6. #6
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Need help inserting new code

    .
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    03-10-2019
    Location
    United States
    MS-Off Ver
    Office 365
    Posts
    31

    Re: Need help inserting new code

    Thanks a lot , actually it was my own mistake , but I just realized it , the value I am looking for is "Play the favorite" ; and "Play the Dog", totally different from what I wrote on the code for applyingcolorCFB , I have inside the code "play favorite" and "play dog"
    I just adjusted it and the color now has been applied. Thanks a lot for the guidance. The answer was there all along but I wasn't careful enough to read the lines the correct way and write it the right way.

  8. #8
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Need help inserting new code

    .
    Most errors are something that is overlooked. Glad I could 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. [SOLVED] Need help on inserting the code inside code?
    By B.W.B. in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 10-02-2017, 07:13 AM
  2. Inserting Progress Bar Code Into Existing VBA Code
    By BDBJ1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-15-2016, 11:58 AM
  3. Inserting VBA code...
    By Kris in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-10-2006, 01:25 PM
  4. inserting code into code module crashes
    By Kris in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-25-2006, 01:30 PM
  5. [SOLVED] Inserting a Code
    By Alex Martins in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-29-2005, 08:05 PM
  6. [SOLVED] RE: Inserting a Code
    By Jim Thomlinson in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-29-2005, 05:05 PM
  7. [SOLVED] RE: Inserting a Code
    By Alex Martins in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-29-2005, 05:05 PM

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