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.
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
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.
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.
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 :-
sample file attached to facilitate further explanation, if still not clear post your file. Thanks.=OFFSET(Sheet1!$B$21,0,0,COUNTA(Sheet1!$B$21:$B$1048576),1)
Regards,
DILIPandey
<click on below 'star' if this helps>
DILIPandey
+919810929744
dilipandey@gmail.com
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
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...
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
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.
sorry, I dont think that one works I have re posted
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
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.
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
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.
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
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks