+ Reply to Thread
Results 1 to 14 of 14

Macro insert multiple sheet and insert age band based on numbers

  1. #1
    Forum Contributor
    Join Date
    11-17-2015
    Location
    India
    MS-Off Ver
    2013
    Posts
    365

    Macro insert multiple sheet and insert age band based on numbers

    Macro insert multiple sheet and insert age band based on numbers
    Hi,
    I have a data in Sheet “Data”. In Sheet “Data” I have age of all members in Column ‘E’.

    In next sheet “Age Band” I have different types of Age Band in Different Columns.

    Macro to do below mentioned task.

    1) Create New Sheet. Sheet Name Should be heading of the first column in from Sheet “Age Band”. Example sheet given (Sheet “ABC”).
    2) Copy entire records from Sheet “Data” till the end of serial number and paste the same in newly created sheet.
    3) Now in newly created sheet “ABC” in column ‘F’, pull age band mentioned below heading of ABC from Sheet “Age Band”.

    After above task again new sheet to be created and sheet name should be the second heading from Sheet “Age Band” and repeat task no 2 and 3. Please refer example sheet.

    Please note:
    Number of newly created sheet be equal to number of headings (ABC,BDC, ASD) in sheet “age band”
    All records till the end of serial number (Column-A) to be copied in new sheets.
    Before creating any new sheet, first check whether with the same name already sheets is exist or Not. If exist then delete the same and then create new sheet.
    Please provide steps remarks against all code. So that I can change it later on as per our requirement.
    Attached Files Attached Files
    Last edited by saravanan1981; 07-22-2017 at 08:13 AM. Reason: attachement missing

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro insert multiple sheet and insert age band based on numbers

    Hi saravanan1981

    Try this Code in the attached...I believe it does as you require...

    Please Login or Register  to view this content.
    I'll comment the Code as you requested...assuming it works as required...
    Attached Files Attached Files
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  3. #3
    Forum Contributor
    Join Date
    11-17-2015
    Location
    India
    MS-Off Ver
    2013
    Posts
    365

    Re: Macro insert multiple sheet and insert age band based on numbers

    Dear jaslake,
    Thanks buddy. It works perfect.

    Please provide comment.

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro insert multiple sheet and insert age band based on numbers

    Hi saravanan1981

    Commented Code...questions...please ask...
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    11-17-2015
    Location
    India
    MS-Off Ver
    2013
    Posts
    365

    Re: Macro insert multiple sheet and insert age band based on numbers

    hi jaslake,
    Thank you very much.

    Just have below queries. Please find attached sample file. In Sample file I have just added 2 columns and rename the heading of all columns. I am getting following error

    1) Age band for last column with heading "United_India" is not created in new sheet. It shows some error.
    2) Age Band in Newly crated sheet "SBI_General" in cell number F8 and F9 is coming in date format.

    Please help me with rectification.
    Attached Files Attached Files

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro insert multiple sheet and insert age band based on numbers

    Hi saravanan1981

    Regarding this...you have a trailing space in Cell X1 "United_India " of Sheet Age Band...remove it.
    1) Age band for last column with heading "United_India" is not created in new sheet. It shows some error.
    Trailing Space.jpg



    Regarding this...you have a leading apostrophe in Cell O3 '2-18 of Sheet Age Data...remove it...
    2) Age Band in Newly crated sheet "SBI_General" in cell number F8 and F9 is coming in date format.
    Leading Apostrophe.jpg

  7. #7
    Forum Contributor
    Join Date
    11-17-2015
    Location
    India
    MS-Off Ver
    2013
    Posts
    365

    Re: Macro insert multiple sheet and insert age band based on numbers

    Got it space issue is resolved.

    But Tried removing apostrophe in O3. It is changing to Feb-18 and the same is not coming in new sheet. How to control it?

    and same is happening with cell no. D3, v3,

  8. #8
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro insert multiple sheet and insert age band based on numbers

    saravanan1981

    I added the indicated Line of Code and appears to have resolved the issue...and the apostrophe appears to be required...
    Please Login or Register  to view this content.
    Attached Files Attached Files

  9. #9
    Forum Contributor
    Join Date
    11-17-2015
    Location
    India
    MS-Off Ver
    2013
    Posts
    365

    Re: Macro insert multiple sheet and insert age band based on numbers

    hi jaslake,
    Thank you very much once again.

    Actually I wanted to make this file as master file for all manual work.


    Can you please help me with further code to process below task?

    Code to convert value in Column J based on value in column I

    1 If Value in column "I" is "Self" Keep value in column "J" as "Self". Irrespective of small letters or capital letters.
    2 If Value in column "I" is "Employee" Keep value in column "J" as "Self". Irrespective of small letters or capital letters.
    3 If Value in column "I" is "Proposer" Keep value in column "J" as "Self". Irrespective of small letters or capital letters.
    4 If Value in column "I" is "Spouse" Keep value in column "J" as "Spouse". Irrespective of small letters or capital letters.
    5 If Value in column "I" is "Spouce" Keep value in column "J" as "Spouse". Irrespective of small letters or capital letters.
    6 If Value in column "I" is "Husband" Keep value in column "J" as "Spouse". Irrespective of small letters or capital letters.
    7 If Value in column "I" is "Wife" Keep value in column "J" as "Spouse". Irrespective of small letters or capital letters.
    8 If Value in column "I" is "Child" OR "Children" Keep value in column "J" as "Children". Irrespective of small letters or capital letters.
    9 If Value in column "I" is "Son" Keep value in column "J" as "Children". Irrespective of small letters or capital letters.
    10 If Value in column "I" is "Daughter" Keep value in column "J" as "Children". Irrespective of small letters or capital letters.
    11 If Value in column "I" is "Sibling" Keep value in column "J" as "Siblings". Irrespective of small letters or capital letters.
    12 If Value in column "I" is "Brother" Keep value in column "J" as "Siblings". Irrespective of small letters or capital letters.
    13 If Value in column "I" is "Sister" Keep value in column "J" as "Siblings". Irrespective of small letters or capital letters.
    14 If Value in column "I" is "Parent" OR "Parents" Keep value in column "J" as "Parents". Irrespective of small letters or capital letters.
    15 If Value in column "I" is "Father" Keep value in column "J" as "Parents". Irrespective of small letters or capital letters.
    16 If Value in column "I" is "Mother" Keep value in column "J" as "Parents". Irrespective of small letters or capital letters.
    17 If Value in column "I" is "in-law" OR "in-laws"Keep value in column "J" as "In-Laws". Irrespective of small letters or capital letters.
    18 If Value in column "I" is "Father-in-law" Keep value in column "J" as "In-Laws". Irrespective of small letters or capital letters.
    19 If Value in column "I" is "Mother-in-law" Keep value in column "J" as "In-Laws". Irrespective of small letters or capital letters.
    20 If any other value in Column "I" other than above 19 values, Keep value in Column "J" as "Please check relation". against all members of particular family
    Also please provide provision to replace more relation if added in future


    Code to convert value in Column K based on value in column J

    In family description column need code to put the count of number of relation as mentioned in sheet "Example data"





    Code to convert value in Column L based on value in column J

    1 If Value in column "J" is "Self" Keep value in column "L" as "Self"
    2 If Value in column "J" is "Spouse" OR "Children" OR "Siblings"OR "Parents" OR "In-Laws" Keep value in column "L" as "Depedents"
    3 If Value in column "J" is "Please check relation" Keep value in column "L" as "Please check relation".
    Also please provide provision to replace more relation if added in future



    Code to convert value in Column M based on value in column L

    1.Count Number of Dependents in Column L in family wise, then assign number to it. We have two Check point here.
    one is Employee code [Column "B"]which will be unique for each family and second one is column "L" where "Self" andsebsequent dependents are their depedents.
    Also please provide provision to replace more relation if added in future


    After performing above task.

    I need code to generate one more sheet for pertaining to all heading in SHeet "Age Band" like how we created New sheet with name of each heading.

    This time new sheet to be created with Extension of text "demography". For Example first Sheet to be created as per your old code with name "Aditya_Birla" now with new code we should be able to create next sheet as "Aditya_Birla_demography" and create sheet "Apollo_Munich" and then create "Apollo_Munich_demography" and so on.

    Now in Demography sheet I wanted create a template for each heading's as mentioned in sheet "Example_Aditya_Birla_demography". So in sheet "Apollo_Munich_demography" Template will be as per the age band mentioned below heading of "Apollo_Munich" in sheet "age Band".

    Request you to help me on this. This will solve my huge time.
    Attached Files Attached Files

  10. #10
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro insert multiple sheet and insert age band based on numbers

    Hi saravanan1981

    Wow...anything else...is this it?
    You're talking hours of development and testing time...have you considered using the Commercial Services Sub Forum for these needs?

  11. #11
    Forum Contributor
    Join Date
    11-17-2015
    Location
    India
    MS-Off Ver
    2013
    Posts
    365

    Re: Macro insert multiple sheet and insert age band based on numbers

    No Not yet.

    can u help me on this?

  12. #12
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro insert multiple sheet and insert age band based on numbers

    Hi saravanan1981

    I'd suggest you start a new Thread for these new issues as they are far beyond the scope of your Tread Title and accordingly will most likely receive few views.

    If the issue of this Thread is Solved please mark it so.

  13. #13
    Forum Contributor
    Join Date
    11-17-2015
    Location
    India
    MS-Off Ver
    2013
    Posts
    365

    Re: Macro insert multiple sheet and insert age band based on numbers

    Dear Jaslake,
    the last code you provided is perfect. I just request you to a line of code to add additional equal number blank sheets with same name with string "_Demo" (e.g given in attachment)

    Please help
    Attached Files Attached Files

  14. #14
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro insert multiple sheet and insert age band based on numbers

    Hi saravanan1981

    I've added the indicated Line of Code...

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by jaslake; 08-01-2017 at 01:50 PM.

+ 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. Insert/Delete rows based on the same numbers of rows with data in other sheet
    By Blokeman in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-25-2015, 08:28 PM
  2. Macro to Insert Multiple Images to Multiple Sheet of a Excel Workbook.
    By Nimalan_Dude in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-07-2014, 11:18 PM
  3. Replies: 2
    Last Post: 10-31-2013, 05:00 PM
  4. Macro to copy and insert cpoed row data based on numbers in the column
    By hazemrezo in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-08-2013, 08:08 PM
  5. Excel Macro to insert two rows based on condition and copy and paste multiple cells
    By mannabhalo in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-13-2012, 12:56 PM
  6. [SOLVED] VB Macro to insert value in cell based on multiple criteria in a row
    By haleakala17 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-23-2012, 10:30 PM
  7. Insert multiple rows from one sheet to another based on a value in a cell
    By sashikanth2274 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-14-2010, 11:37 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