A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
After much frustration I finally found what I was looking for. IT is: Range(cell location).Name. it's the ".Name" I needed.
So below is the macro I've created to do what I needed. It runs about 20 seconds because there's 480 cells that need to have names assigned. That's 480 names per decade.
If you look at this and have suggestions for improving it I'm willing to give it a try. If you find this macro usefully please let me know.
Sub Set_Cell_Names()
' this macro will add cell names to a range of cells; 4 cells per month
' and 10 years. So, 480 cell names will be created.
' Be patient, the run process time is 15-20 seconds per worksheet
' It only creates cell names for the current worksheet that is opened.
Dim AvgHighStr, AvgLowStr, city_yr, MaxHighStr, MinLowStr, Month, tab_name, YearStr As String
Dim AvgHigh, AvgLow, Mth_cntr, Year_cntr, Row_nbr As Integer
Maxhigh = "Max_high_"
MinLow = "Min_low_"
AvgHigh = "Avg_high_"
AvgLow = "Avg_low_"
tab_name = ActiveSheet.Name ' extract the name for the worksheet into a variable name
'extract 4 digits in tab year
'tab names arer: Tab 1900's, Tab 1910's thru Tab 2010's
city_yr = Mid(tab_name, (InStr(1, tab_name, "'") - 4), 4)
Year_cntr = 0
Row_nbr = 35
While Year_cntr <= 9 ' loops 10 times: 0-9
Mth_cntr = 1
Month = Right("0" & Mth_cntr, 2)
YearStr = Right("0" & Year_cntr, 2)
While Mth_cntr < 13 ' loops 12 times to populate cells for each year
' creating naming strin values for Max, Min, & Averages
MaxHighStr = Maxhigh & city_yr & "_" & YearStr & "_" & Month
MinLowStr = MinLow & city_yr & "_" & YearStr & "_" & Month
AvgHighStr = AvgHigh & city_yr & "_" & YearStr & "_" & Month
AvgLowStr = AvgLow & city_yr & "_" & YearStr & "_" & Month
' calculating cell locations and added names to corresponding cells
cell_loc = "C" & Row_nbr
Range(cell_loc).Name = MaxHighStr
cell_loc = "E" & Row_nbr
Range(cell_loc).Name = MinLowStr
Row_nbr = Row_nbr + 1
cell_loc = "C" & Row_nbr
Range(cell_loc).Name = AvgHighStr
cell_loc = "E" & Row_nbr
Range(cell_loc).Name = AvgLowStr
' okay, 1 month of cells have been named now add 1 to year and redo
' this will set up cell names for month in each year for the work sheet
' that is showing.
Row_nbr = Row_nbr + 34
Mth_cntr = Mth_cntr + 1
Month = Right("0" & Mth_cntr, 2)
Wend
' okay, 1 year of cells have been named now add 1 to year and redo
' this will set up cell names for the years 00 thru 09 for the decade
' that is showing.
Year_cntr = Year_cntr + 1
Wend
End Sub