+ Reply to Thread
Page 1 of 3 123 LastLast
Results 1 to 15 of 31

Thread: Create Names Automacilly in a column

  1. #1
    Registered User
    Join Date
    09-08-2011
    Location
    New Zealand
    MS-Off Ver
    Excel 2007
    Posts
    67

    Create Names Automacilly in a column

    Hi,

    I need to automaticaly create names for rows, ie: in column B, I need to create names L1, L2, L3, etc, starting from B21, and only going down as far as the rows that are being used.

    I need a macro activated from a button, that will automatically start naming at B21, and go down as far as rows are being used, each time the worksheet is used, the amount of rows will differ.

    Is this possible ?

    I am ok with the button and record a macro, but I do not know what to record.

    Many thanks.
    Last edited by T. Grindlay; 02-06-2012 at 04:09 AM.

  2. #2
    Valued Forum Contributor dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    New Delhi, India
    MS-Off Ver
    Excel 1997, 2000, XP, 2003, 2007, 2010
    Posts
    2,398

    Re: Create Names Automacilly in a column

    Hi Grindlay,


    What I am able to understand from your post that you want to automatically create name starting from column B row 21 (i.e., B21) which will cover all the entries in that row .. and then when you open this workbook again .. you need another name (L2) to cover B22 ..... to cover all entries in that row (i.e, 22) and so on. Let me know if I am correct in my understanding.

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    DILIPandey
    +919810929744
    dilipandey@gmail.com

  3. #3
    Registered User
    Join Date
    09-08-2011
    Location
    New Zealand
    MS-Off Ver
    Excel 2007
    Posts
    67

    Re: Create Names Automacilly in a column

    Thanks, the names need to be listed down the B column, starting at B21, and going down as far as the rows are being used eg:

    B21 name L1
    B22 name L2
    B23 name L3

    and so forth, each time the sheet is used, the amount of used rows will vary, (one day B21 - B40, the next day B21 - B35)

    I am hoping Excel can recognise which rows are in use, and only assign a name to those. Thanks.

  4. #4
    Registered User
    Join Date
    09-08-2011
    Location
    New Zealand
    MS-Off Ver
    Excel 2007
    Posts
    67

    Re: Create Names Automacilly in a column

    It needs to be automated, just a button to add the names, so they show up when printed, as the people that will be using the sheet will not know how to name it each time, (unless manually), and it is to cumbersome unless auto. Thanks.

  5. #5
    Valued Forum Contributor dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    New Delhi, India
    MS-Off Ver
    Excel 1997, 2000, XP, 2003, 2007, 2010
    Posts
    2,398

    Re: Create Names Automacilly in a column

    Ok... if the data will be in column B only, as you just shared in your post, you can use below formula to define a dynamic name which will dynamically / automatically considers the varying ranges in column B :-

    =OFFSET(Sheet1!$B$21,0,0,COUNTA(Sheet1!$B$21:$B$1048576),1)
    sample file attached to facilitate further explanation, if still not clear post your file. Thanks.

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    Attached Files Attached Files
    DILIPandey
    +919810929744
    dilipandey@gmail.com

  6. #6
    Valued Forum Contributor
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2007
    Posts
    455

    Re: Create Names Automacilly in a column

    As per your words, B21-B40 may produce 20 names: L1->L20? Is it comfortable?
    You may be thinking of dynamic name, which can cover all used cells in range automatically. Try this:
    Name: Name1
    Refer to: =OFFSET($B$21,,,COUNTA($B$21:$B$65000))
    Is this your issue?
    Click the star icon in left-corner of my post if you find my post userful!

    Quang PT
    quangphanidico@yahoo.com
    PM me: Y!M: quangphanidico

  7. #7
    Registered User
    Join Date
    09-08-2011
    Location
    New Zealand
    MS-Off Ver
    Excel 2007
    Posts
    67

    Re: Create Names Automacilly in a column

    Thanks, I am not sure what to do with this formula, it does not seem to be entered anywhere in the worksheet you posted, this worksheet I have has a calculator and many other sheets linked, it may not be practical to post, I will try to replicate scenario, thanks for assistance...

  8. #8
    Valued Forum Contributor
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2007
    Posts
    455

    Re: Create Names Automacilly in a column

    If "name" is unfamiliar to you, try this to create "name":
    Ctrl-F3
    Name: i.e: ABC
    Refer to: = your expression.
    OK
    Click the star icon in left-corner of my post if you find my post userful!

    Quang PT
    quangphanidico@yahoo.com
    PM me: Y!M: quangphanidico

  9. #9
    Registered User
    Join Date
    09-08-2011
    Location
    New Zealand
    MS-Off Ver
    Excel 2007
    Posts
    67

    Re: Create Names Automacilly in a column

    Thanks, I have posted this sheet to show what I mean, each time the button is pressed, it creates a new row, each day the button will be pressed a different amount of times, I need another button to press to create a name for the new rows (in the B column)

    once the add row / summarry button is pushed no more, then we can hit create name button, then save with job and print, new book started for new job.

    (or if some summary data rows are deleted, then can hit create name button to rename?

    Thanks.

  10. #10
    Registered User
    Join Date
    09-08-2011
    Location
    New Zealand
    MS-Off Ver
    Excel 2007
    Posts
    67

    Re: Create Names Automacilly in a column

    sorry, I dont think that one works I have re posted
    Attached Files Attached Files

  11. #11
    Valued Forum Contributor dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    New Delhi, India
    MS-Off Ver
    Excel 1997, 2000, XP, 2003, 2007, 2010
    Posts
    2,398

    Re: Create Names Automacilly in a column

    Ok... When I press the button it started populating the data in column C and E, starting from row 21.

    Now do you want to create a name for the items in C or do you want to create a name for items in E or both ?

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    DILIPandey
    +919810929744
    dilipandey@gmail.com

  12. #12
    Registered User
    Join Date
    09-08-2011
    Location
    New Zealand
    MS-Off Ver
    Excel 2007
    Posts
    67

    Re: Create Names Automacilly in a column

    Thanks, I just want to create a name for each row where the data is displayed, (each new row created by pressing the button), the name would be displayed in the B Column.

  13. #13
    Valued Forum Contributor dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    New Delhi, India
    MS-Off Ver
    Excel 1997, 2000, XP, 2003, 2007, 2010
    Posts
    2,398

    Re: Create Names Automacilly in a column

    Ok.. you want to create a name for each row... but since you'll have only two entries per row, C21 & E21 and then C22 & E22 and so on.., So the name would be for only these two cells Or it would be C21:E21 (covering 3 cells C21, D21, E21)... ?

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    DILIPandey
    +919810929744
    dilipandey@gmail.com

  14. #14
    Registered User
    Join Date
    09-08-2011
    Location
    New Zealand
    MS-Off Ver
    Excel 2007
    Posts
    67

    Re: Create Names Automacilly in a column

    in my actual worsheet, there are about 5 cells used in each new row, I was just hoping the name could refer to the row, if there was any cells in use ... is this possile, thanks.

  15. #15
    Forum Guru TMShucks's Avatar
    Join Date
    07-15-2010
    Location
    Manchester, England
    MS-Off Ver
    MSO 2003 & 2007
    Posts
    6,223

    Re: Create Names Automacilly in a column

    Maybe this will do what you want. Tag it onto your existing code.

    Dim LCR As Long
    LCR = Range("C" & Rows.Count).End(xlUp).Row
    ActiveWorkbook.Names.Add _
        Name:="Row_" & LCR, _
        RefersToR1C1:="=Sheet1!R" & LCR

    Regards, TMS

+ 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.2.0