Naming Cells Using Text in Adjoining Cells

zandalis

New Member
Joined
Feb 23, 2011
Messages
2
I have a workbook containing weekly budgets for an entire fiscal year. Each worksheet contains one week's budget. Therefore there are 52 worksheets, and the amounts are changing every week. Each worksheet has project codes in Cells A2:A94, and dollar amounts in cells D2:D94. I would like to name each cell containing the dollar figures as a combination of the worsheet it is on and its coresponding project code. For instance, for project code ABCD in week 2, that dollar amount cell would be called "ABCDWeek2."

Instead of having to go through and manually name each cell, is there a way to automate this some or use formulas of adjoining cell data to name cells?
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
assuming row no. contains column headings try this macro


Code:
Sub naming()
Dim j As Integer, k As Integer, r As Range, c As Range
j = Worksheets.Count
For k = 1 To j
With Worksheets(k)
'MsgBox k
Set r = Range(.Range("D2"), .Range("D2").End(xlDown))
For Each c In r
c.Name = Cells(c.Row, "A").Value & Worksheets(k).Name
Next c
End With
Next k

End Sub
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,831
Members
452,946
Latest member
JoseDavid

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top