+ Reply to Thread
Results 1 to 8 of 8

VBA Code for only if cell is blank

  1. #1
    Registered User
    Join Date
    09-19-2012
    Location
    CT
    MS-Off Ver
    Excel 2010
    Posts
    29

    VBA Code for only if cell is blank

    Hello,

    I'm looking for the a VBA code to allow me to add my formula only if the cells in the range are blank. I'm trying to have different people provide score / rate different questions. The current MACRO inputs the score in to a different spreadsheet and performs a paste special value to make the value hard. The problem is the macro code I have now does the paste special value for all the cells, and I want it to only complete it if cell has a number. The spreadsheet I'm working off attached. Thanks for the help.
    Attached Files Attached Files

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: VBA Code for only if cell is blank

    Maybe:
    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    09-19-2012
    Location
    CT
    MS-Off Ver
    Excel 2010
    Posts
    29

    Re: VBA Code for only if cell is blank

    Thanks for the response!

    The code works in bringing over the score, but once it does that I need it to paste special value, and lock that score in so the individual can begin rating the other questions. The problem I'm having now is once the person goes to answer the subsequent questions...2,3,4,5,etc. all the previous responses get cleared it. So in my mind I need a code that says paste special value only if the individual cells in the range which are greater than 0.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: VBA Code for only if cell is blank

    The suggested code IS bringing over the numbers as "values", not formulas. I can't follow the rest of what you're asking.

  5. #5
    Registered User
    Join Date
    09-19-2012
    Location
    CT
    MS-Off Ver
    Excel 2010
    Posts
    29

    Re: VBA Code for only if cell is blank

    The end result I'm looking for is to have all the cells in C2:F32 populated with the scores. The problem I'm running in to is every time you go an answer a different question it removes the previous response and only contains the current i.e. it doesn't save the previous scores.

    I believe the change needs to happen in this sequence of the code (below). Is there a way to only copy the formula if the cell is ONLY empty. If the cell contains a # leave the cell as is. I hope this help clarifies.

    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 02-12-2013 at 12:24 PM. Reason: Added code tags, as per forum rules. Don't forget!

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: VBA Code for only if cell is blank

    Don't forget code tags on ALL posted code.

    If you're going to really do that, you'd need to test each target cell one at a time I'd think.

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    09-19-2012
    Location
    CT
    MS-Off Ver
    Excel 2010
    Posts
    29

    Re: VBA Code for only if cell is blank

    I tried the new code, and it's doing the same thing....sigh.

    Maybe I'm approaching it wrong, but ultimately I would like to find a way to answer all 32 questions for each 4 different supplier's. Problem is I can't find a way to answer a question, hard code it in, and then answer the other questions with the scores remaining. I can only get one response in at a time.

  8. #8
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: VBA Code for only if cell is blank

    perhaps
    Please Login or Register  to view this content.
    Last edited by JosephP; 02-15-2013 at 01:08 PM.
    Josie

    if at first you don't succeed try doing it the way your wife told you to

+ 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