+ Reply to Thread
Results 1 to 4 of 4

macro to fill in empty cells with certain formulas or values in.

  1. #1
    Forum Contributor
    Join Date
    01-29-2011
    Location
    Bristol, England
    MS-Off Ver
    Excel 2003
    Posts
    471

    macro to fill in empty cells with certain formulas or values in.

    Hi all
    I wonder if someone can help me out. What would be my best option/method to achieve the following below?

    I would like to have a macro that would fill in some empty cells with certain formulas or values. Macro should look the first available empty cell in columns F,G,H,I,J,K,L,M and populate them as far as column E goes. Below is the breakdown of formulas or values that should go to cells of each column.

    Please Login or Register  to view this content.


    Let me present illustrative example:


    Before macro

    --D ------ E ----------- F ---------- G -------- H ------- I -------- J -------- K -------- L -------- M
    300 ---- 39 ---- Planning ---- OGL ---- 5 ------ 46 ---- Wed ---- 2011 ---- M60 ---- S60
    420 ---- 39 ---- Planning ---- OGL ---- 7 ------ 46 ---- Thu ----- 2011 ---- M60 ---- S60
    90 ------ 5C --- Machines --- OGL ---- 1.5 ---- 46 ---- Thu ----- 2011 ---- M60 ---- S60
    720 ---- 39 ---- Planning ---- OGL ---- 12 ----- 46 ---- Thu ----- 2011 ---- M60 ---- S60
    90 ------ 5C --- Machines --- OGL ---- 1.5 ---- 46 ---- Thu ----- 2011 ---- M60 ---- S60
    120 ---- 12 ---- Machines --- OGL ---- 2 ------ 46 ---- Thu ----- 2011 ---- M60 ---- S60
    300 ---- 23 ---- Manning ----- OGL ---- 5 ------ 46 ---- Thu ----- 2011 ---- M60 ---- S60
    420 ---- 39 ----
    300 ---- 5C ----
    420 ---- 39 ----


    After macro

    --D ------ E ----------- F ---------- G -------- H ------- I -------- J -------- K -------- L -------- M
    300 ---- 39 ---- Planning ---- OGL ---- 5 ------ 46 ---- Wed ---- 2011 ---- M60 ---- S60
    420 ---- 39 ---- Planning ---- OGL ---- 7 ------ 46 ---- Thu ----- 2011 ---- M60 ---- S60
    90 ------ 5C --- Machines --- OGL ---- 1.5 ---- 46 ---- Thu ----- 2011 ---- M60 ---- S60
    720 ---- 39 ---- Planning ---- OGL ---- 12 ----- 46 ---- Thu ----- 2011 ---- M60 ---- S60
    90 ------ 5C --- Machines --- OGL ---- 1.5 ---- 46 ---- Thu ----- 2011 ---- M60 ---- S60
    120 ---- 12 ---- Machines --- OGL ---- 2 ------ 46 ---- Thu ----- 2011 ---- M60 ---- S60
    300 ---- 23 ---- Manning ----- OGL ---- 5 ------ 46 ---- Thu ----- 2011 ---- M60 ---- S60
    420 ---- 39 ---- Planning ---- OGL ----- 7 ------ 46 ---- Fri ------ 2011 ---- M60 ---- S60
    300 ---- 5C ---- Machines --- OGL ---- 5 ------ 46 ---- Fri ------ 2011 ---- M60 ---- S60
    420 ---- 39 ---- Planning ---- OGL ----- 7 ------ 46 ---- Sat ----- 2011 ---- M60 ---- S60


    It would be nice if the macro would populate the cells with the required formulas and would then only keep the values (a la copy-paste-special-values). I have attached an example spreadsheet. Idea is that user will fill in some some cells (cells from col A to col E) on this ever growing spreadsheet and macro will populate the rest (col F to col M).



    Any help would be much appreciated.
    Cheers
    Attached Files Attached Files
    Last edited by rain4u; 11-20-2011 at 01:45 AM.

  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: macro to fill in empty cells with certain formulas or values in.

    Like so:
    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
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: macro to fill in empty cells with certain formulas or values in.

    I came up with this.

    Please Login or Register  to view this content.

    Edit: Go with JBeaucaire's Macro it is much better code than mine.
    On top of that mine is over writing your hard coded stuff
    Last edited by JapanDave; 11-20-2011 at 01:32 AM.

  4. #4
    Forum Contributor
    Join Date
    01-29-2011
    Location
    Bristol, England
    MS-Off Ver
    Excel 2003
    Posts
    471

    Re: macro to fill in empty cells with certain formulas or values in.

    Thank you both of you. Much appreciated. I will sure learn from this. At first sight it works like a charm. Good stuff.

+ 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