+ Reply to Thread
Results 1 to 5 of 5

Macro to paste cells from one sheet into another

  1. #1
    Registered User
    Join Date
    05-29-2013
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    37

    Macro to paste cells from one sheet into another

    Hi!

    I'm new to macros and having some difficulty writing it for this and would love some guidance. I'm trying to copy the values of the range B2:B31 (ignoring blank cells) from Sheet1 into B4:B31 on Sheet2. However, I have four non-adjacent columns on Sheet1 (B2, D2, F2, H2) with the same ranges (B2:B31, D2:D31, etc.) that i'd like to paste adjacently (B4:B33, C4:C33, D4:D33, E4:E33) on Sheet2 - all while ignoring blank cells.


    Generally, I would just use =Sheet1!B2 but blanks show up as #N/A and if i write an if that makes it show up as an empty text string "", the formula i'm trying to use after calculates it incorrectly. So I wanted to write a macro that would just output nothing if there's no value in that cell.

    Thank you<3

    -Lauren

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Macro to paste cells from one sheet into another

    Quote Originally Posted by ayvee0 View Post
    if i write an if that makes it show up as an empty text string "", the formula i'm trying to use after calculates it incorrectly.
    You could modify your "after" formula to ignore the "". What is that formula?

    Otherwise...
    Please Login or Register  to view this content.
    Last edited by AlphaFrog; 05-30-2013 at 11:58 AM.

  3. #3
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Macro to paste cells from one sheet into another

    you could try and use something like:
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    05-29-2013
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    37

    Re: Macro to paste cells from one sheet into another

    Thanks a lot for the help!!!

    For the future, how do you modify the formula to ignore the ""? the ISBLANK function returns FALSE

  5. #5
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Macro to paste cells from one sheet into another

    Quote Originally Posted by ayvee0 View Post
    Thanks a lot for the help!!!

    For the future, how do you modify the formula to ignore the ""? the ISBLANK function returns FALSE
    You're welcome.

    It depends on the formula.

+ 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