Hi,
I am trying to design code to create a defined name for a cell based off the value of another cell. The cell that contains the name that I would like to be the defined name is in cell (“C2”). The cell that I would like to obtain the defined name is the cell above the new column create from this code:
End With
The column headers are competitor names, so I want the cell above the column headers to have the defined name of the competitor name, which comes from cell (“C2”).
What do you think?
I am trying to design code to create a defined name for a cell based off the value of another cell. The cell that contains the name that I would like to be the defined name is in cell (“C2”). The cell that I would like to obtain the defined name is the cell above the new column create from this code:
Code:
Private Sub AddCompetitorButton_Click()
With Sheets("Competitor Overview Data").ListObjects("CompOverviewTable")
.ListColumns.Add(.ListColumns.Count + 1).Name = Range("C2")
.ListColumns(.ListColumns.Count - 1).Range.EntireColumn.Copy
.ListColumns(.ListColumns.Count).Range.EntireColumn.PasteSpecial Paste:=xlPasteFormats
The column headers are competitor names, so I want the cell above the column headers to have the defined name of the competitor name, which comes from cell (“C2”).
What do you think?
Last edited: