+ Reply to Thread
Results 1 to 20 of 20

Copy numbers to fill in blanks

  1. #1
    Registered User
    Join Date
    01-15-2014
    Location
    Newark, DE
    MS-Off Ver
    Excel 2007
    Posts
    91

    Copy numbers to fill in blanks

    Need some help please. I have a column of numbers like so in column B but what I need is what I'm showing in Column A.

    20004 20004
    20004
    20138 20138
    20138
    20138
    20138
    20139 20139
    20139
    20139
    20433 20433
    20433
    20433
    20433
    21060 21060
    21061 21061

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Copy numbers to fill in blanks

    Try this macro

    Please Login or Register  to view this content.
    Open up the VBA editor by hitting ALT F11

    Insert a new module by hitting Insert - Module

    Paste the macro into the empty sheet

    Hit ALT F11 to get back to the worksheet.

    Run the macro by going to tools-macro in Excel 2003 or the view ribbon in Excel 2007/2010/2013.
    Martin

  3. #3
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Copy numbers to fill in blanks

    Select the column. Hit F5 (opens GoTo Window)
    Click Special> Blanks> OK (this selects all your blank cells in chosen range)
    Type "=" then hit the up arrow
    Then CNTRL + ENTER

    You may want to then go back and copy >Paste Special Values over the cells to remove the formulas
    Last edited by ChemistB; 08-13-2015 at 03:11 PM.
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  4. #4
    Registered User
    Join Date
    01-15-2014
    Location
    Newark, DE
    MS-Off Ver
    Excel 2007
    Posts
    91

    Re: Copy numbers to fill in blanks

    Sorry I don't use VBA so I was looking for a formula solution but I'll see if I can fumble my way through this.

  5. #5
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Copy numbers to fill in blanks

    My solution is not VBA and is much simplier than it looks.

  6. #6
    Registered User
    Join Date
    01-15-2014
    Location
    Newark, DE
    MS-Off Ver
    Excel 2007
    Posts
    91

    Re: Copy numbers to fill in blanks

    I'm selecting Column A, the blank one correct?

  7. #7
    Registered User
    Join Date
    01-15-2014
    Location
    Newark, DE
    MS-Off Ver
    Excel 2007
    Posts
    91

    Re: Copy numbers to fill in blanks

    I'm getting results of all zeros.??

  8. #8
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Copy numbers to fill in blanks

    Select the column with the values and blanks interspersed.
    Then F5 (open GoTo Window), then Special>Blanks>OK
    You'll see that the blanks are all selected in your active range
    without touching anything else, type in = and then up arrow
    (in the formula text box, you'll see = A1 or something like that (whichever is the cell above your first blank)
    Then CNTRL + ENTER

  9. #9
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Copy numbers to fill in blanks

    Quote Originally Posted by shdwfx View Post
    I'm selecting Column A, the blank one correct?
    Select the column with the blanks in it which you want to have filled in - probably Column B. Then follow the rest of ChemistB's instructions. As he suggested, you probably want to finish by copying the entire range then pasting it over itself as values.


    Edit: ChemistB beat me to it...


    Regards,
    Aardigspook

    If your problem is solved, please go to 'Thread Tools' above your first post and 'Mark Thread as Solved'.
    You don't need to give me rep if I helped, but thanks are appreciated.
    Last edited by Aardigspook; 08-13-2015 at 03:31 PM. Reason: beaten to it

  10. #10
    Registered User
    Join Date
    01-15-2014
    Location
    Newark, DE
    MS-Off Ver
    Excel 2007
    Posts
    91

    Re: Copy numbers to fill in blanks

    Well I must be doing something wrong because it's not working. I selected Column B (with the values and blanks), hit F5, special ->blanks->OK but it's just sitting there in cell B1, not highlighting the column.

  11. #11
    Registered User
    Join Date
    01-15-2014
    Location
    Newark, DE
    MS-Off Ver
    Excel 2007
    Posts
    91

    Re: Copy numbers to fill in blanks

    Oh and I get to where I see the =A1 in A1 but I hit CNTRL + ENTER and nothing happens.

  12. #12
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Copy numbers to fill in blanks

    Okay, I did a step by step screenshots. See if attached helps.
    Attached Files Attached Files

  13. #13
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Copy numbers to fill in blanks

    If it's still not working for you, here's an alternative.
    Assuming data is in B starting in B1
    First copy B1 over to A1
    Then In A2 copied down as far as you want

    =IF(ISBLANK(B2), A1, B2)

    Then copy>Paste Special>Values to remove the formulas.

  14. #14
    Registered User
    Join Date
    01-15-2014
    Location
    Newark, DE
    MS-Off Ver
    Excel 2007
    Posts
    91

    Re: Copy numbers to fill in blanks

    You last solution is working but only for the second occurrence, the second line of the same material number....not working for the other lines. I followed your step by step and it's still not working for me. Having just tried it one more time it now says No Cells Found after I hit the up arrow.

  15. #15
    Registered User
    Join Date
    01-15-2014
    Location
    Newark, DE
    MS-Off Ver
    Excel 2007
    Posts
    91

    Re: Copy numbers to fill in blanks

    I figured it out. Very sloppy but it worked. I added in Column A, the values of H on all lines that had a number and L on all of the blank rows. Then I used =IF(AND(A2="H")B2,"") which I copied down to all of the blanks. That filled in all of the second blank lines. Then I used =IF(AND(A6="H"),B6,B5) on the remaining blanks and those were filled in. Like I said, the hard way but at least I got where I was going. Thanks!!

  16. #16
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Copy numbers to fill in blanks

    Glad to hear you got the result you needed.

    Regards,
    Aardigspook

    If your problem is solved, please go to 'Thread Tools' above your first post and 'Mark Thread as Solved'.
    You don't need to give me rep if I helped, but thanks are appreciated.

  17. #17
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Copy numbers to fill in blanks

    Yes, sorry you couldn't get my solutions working. The important thing is that it works for you now.

  18. #18
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Copy numbers to fill in blanks

    I kind of like Martin's macro in post #2.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  19. #19
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Copy numbers to fill in blanks

    LOL, I do too. Saved it to my personel macro book.

  20. #20
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Copy numbers to fill in blanks

    Quote Originally Posted by shdwfx View Post
    I'm getting results of all zeros.??
    I worked out why this happened - if row 1 of the selected column is blank, this will give all zeroes. There are two ways round it - either select only the range needed (A3 to A50, or whatever) or put something into row 1 temporarily (like 'xyz', do the F5→Special→Blanks→=→Up→Ctrl-Enter trick, then delete the temporary text.

    I know you don't need this info now, but maybe it'll be of use to someone...

    Regards,
    Aardigspook

    If your problem is solved, please go to 'Thread Tools' above your first post and 'Mark Thread as Solved'.
    You don't need to give me rep if I helped, but thanks are appreciated.

+ 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. fill in the blanks
    By pmugagga in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-07-2013, 10:54 AM
  2. Scan a Column A (numbers and blanks) and copy its contents WITHOUT BLANKS into Column B
    By bighandsam in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-12-2012, 05:16 PM
  3. Copy and fill cells with existing numbers
    By Vestlink in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-17-2012, 08:21 AM
  4. to fill in the blanks on a Pivot table without using copy and paste
    By oasalako1 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-13-2012, 01:51 PM
  5. Fill Blanks
    By VBA Noob in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-20-2006, 05:06 AM
  6. [SOLVED] Fill in the blanks!
    By Bhupinder Rayat in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-02-2006, 12:50 PM
  7. [SOLVED] Fill in the blanks!
    By Bhupinder Rayat in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-02-2006, 12:50 PM
  8. Copy selected cell in column and fill in blanks
    By Bluestar in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-15-2005, 10:28 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