+ Reply to Thread
Results 1 to 8 of 8

Populating column based on specific cell value

  1. #1
    Forum Contributor
    Join Date
    11-11-2012
    Location
    Muscat, Oman
    MS-Off Ver
    Office 365
    Posts
    521

    Populating column based on specific cell value

    Dear Experts,

    In a workbook in all worksheets D1 has Month Last Year and E1 has Month This Year.

    Eg.
    Sheet 1 cell D1 contains ‘Jan-13 cell E1 ‘Jan-14
    Sheet 2 cell D1 contains ‘Feb-13 cell E1 ‘Feb-14
    We have 13 sheets (12 months and one total sheet)

    What I want to do is

    For each worksheet in the workbook

    Insert column A
    A1 .value = Month
    All other rows in column A pick up the month from D1 of respective worksheet Eg Jan or Feb…..
    Change D1 to 2013 iso ‘Jan-13 and Change E1 to 2014 iso ‘Jan-14
    Best Regards/VKS

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Populating column based on specific cell value

    Maybe:

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    11-11-2012
    Location
    Muscat, Oman
    MS-Off Ver
    Office 365
    Posts
    521

    Re: Populating column based on specific cell value

    Thanks for your time and help John,
    This gives me a run time error 13 Type Mismatch on
    Please Login or Register  to view this content.
    Best Regards/VKS

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Populating column based on specific cell value

    Can you provide a sample with a couple of sheets which it errors on? When I tested it on some dummy data, I didn't receive an error.

  5. #5
    Forum Contributor
    Join Date
    11-11-2012
    Location
    Muscat, Oman
    MS-Off Ver
    Office 365
    Posts
    521

    Re: Populating column based on specific cell value

    Attached is the file before running the code.
    After running the code it gets stuck in sheet 14 column A1

    Have also added the desired output in first two worksheets.
    Thanks/VKS
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Populating column based on specific cell value

    Maybe:

    Please Login or Register  to view this content.
    I assumed Sheet14 is a Summary Sheet which should be treated differently?

  7. #7
    Forum Contributor
    Join Date
    11-11-2012
    Location
    Muscat, Oman
    MS-Off Ver
    Office 365
    Posts
    521

    Re: Populating column based on specific cell value

    Wowww.... Thanks for your help works beautifully.
    You are right Sheet 14 is to be deleted and all individual sheets will be taken to one sheet to be used as source data of a pivot table.
    Marking this as solved and you have my rep points for your help.

    Since I have picked up little bit of VBA skills from the forum only and self training myself I have a question please see if you can help me understand
    what is the difference between
    Please Login or Register  to view this content.
    and
    Please Login or Register  to view this content.
    and I have seen very few codes (that I requested help on) using
    Please Login or Register  to view this content.
    Do u think this link is appropriate to ask above or should I start a new thread
    Best Regards/VKS

  8. #8
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Populating column based on specific cell value

    You're welcome. Glad to help out and thanks for the feedback and the reps. Activeworkbook can mean any workbook you choose to run the code on. Thisworkbook is where the code resides, therefore the macro can only be used on the worksheets in which the code resides. I know most will say ws.activate is not needed. Often however, when I put it in it makes some code which had been erroring out run? So I've become accustomed to using it.

+ 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. Auto Populating based on specific data
    By Stechnical in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-08-2014, 01:10 AM
  2. [SOLVED] Populating a listbox according to specific criteria in one column
    By cath1509 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 11-27-2013, 06:54 PM
  3. [SOLVED] Populating mutiple cells based on specific values
    By Grillpan in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-14-2012, 09:12 AM
  4. [SOLVED] copying specific certain column data based on cell/column value to another sheet
    By arctic7 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-09-2012, 03:38 PM
  5. [SOLVED] Populating Specific Lists Based on Criteria
    By Kate in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-15-2005, 05:05 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