+ Reply to Thread
Results 1 to 4 of 4

Run Time error 438 help

  1. #1
    Forum Contributor
    Join Date
    08-10-2009
    Location
    nottingham
    MS-Off Ver
    Excel 2010
    Posts
    110

    Run Time error 438 help

    Hello,

    I've got a loop in use which colors a cell based on it's value. It works fine, except anything below 50 goes Red; including the blank cells. I need the blank cells to remain their original color I added another if statement for anything <0 but i now get a runtime error 438.

    I've tried sorts here including IsEmpty(), but cannot get any of them to work...

    How do i get it to only change the value of the cell if it contains a number?

    Please Login or Register  to view this content.
    thanks

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Run Time error 438 help

    If all the conditions fail the code will pick up the last line

    Else

    Cells(rn, cn).Interior.Colour = RGB(36, 64, 88)

    regardless of the if condition.
    If you want to include empty cell

    Please Login or Register  to view this content.
    Last edited by AB33; 10-11-2015 at 08:43 AM.

  3. #3
    Forum Contributor
    Join Date
    08-10-2009
    Location
    nottingham
    MS-Off Ver
    Excel 2010
    Posts
    110

    Re: Run Time error 438 help

    excellent AB33, thank you.

    Out of curiosity, why have you changed the referral from "CellScore" for "Cell(rn, cn)"

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Run Time error 438 help

    Nothing special!
    You have assigned
    Cells(rn, cn).Value to CellScore.
    I understand it might be easier to understand the flow of the code and might not matter in few lines, but in large code you are adding extra line for the code to go through and can be avoided as you can jump straight in the range instead of assigning the range in to another variable.

+ 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. VBA ERROR: run time error 1004: Application-defined or Object-defined error in excel 2013
    By AnanthKrishna in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-13-2015, 06:16 AM
  2. Loop Nesting is returning Run-Time Error '-2147221080 (800401a8)': Automation Error
    By ChristopherBrandonKi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-21-2014, 02:36 PM
  3. Cannot Publish Excel Pivot Chart - Run Time Error
    By crisb184 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-11-2013, 07:04 AM
  4. [SOLVED] Error " Run-time error '1004': application defined or object defined error
    By lengwer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-11-2013, 07:26 AM
  5. Replies: 7
    Last Post: 05-15-2013, 09:02 AM
  6. run-time error ;2147023179 (800706b5) time automation error interface unknown
    By karthik72 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-02-2012, 09:31 AM
  7. Error "run-time Error '1004': General Odbc Error
    By D4WNO77 in forum Access Tables & Databases
    Replies: 2
    Last Post: 07-16-2012, 09:55 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