+ Reply to Thread
Results 1 to 2 of 2

Macro adds number to entire selection, how to avoid adding to blank cells?

  1. #1
    Forum Contributor
    Join Date
    04-02-2012
    Location
    Ohio
    MS-Off Ver
    Excel 2010
    Posts
    452

    Macro adds number to entire selection, how to avoid adding to blank cells?

    I have recorded the below macro which will copy a value and the paste special and add it to the selection. The problem is that it is adding the value to blank cells when I do not want it to. Can this code be modified so that it doesn't add to blank cells. In the paste special dialog box I clicked skip blanks but this didn't change anything.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,265

    Re: Macro adds number to entire selection, how to avoid adding to blank cells?

    Change
    Please Login or Register  to view this content.
    to this, if the cells have values and not formulas
    Please Login or Register  to view this content.
    or this, if the cells have formulas
    Please Login or Register  to view this content.
    and if they are all values, you don't need to use all that selecting (though this is just a guess as to which sheet is active when the code is run)

    Please Login or Register  to view this content.
    Last edited by Bernie Deitrick; 02-26-2014 at 03:14 PM.
    Bernie Deitrick
    Excel MVP 2000-2010

+ 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. Macro to search column for blank cells & shift entire row right
    By BirdS in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-22-2014, 08:07 AM
  2. [SOLVED] Macro that searches a column for all the blank cells then highlights the row entire row.
    By TheOllie in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-09-2012, 09:41 AM
  3. how can avoid considering of blank cells in IF function
    By Lika in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-12-2006, 05:30 AM
  4. [SOLVED] Looping Macro That adds a blank row between different part #'s
    By fiero84 in forum Excel General
    Replies: 5
    Last Post: 03-25-2005, 03:06 AM
  5. [SOLVED] Number of different items in an entire column without knowing if some of the cells are blank
    By sam.fares@cmcsg.com in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-20-2005, 02:06 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