I would like to refer to the values of the column using a VBA macro. The problem that I'm facing is If someone introduces a new column in between the columns the code becomes absolute. Below is my code snippet for reference.
Public Function Area()
row = ActiveCell.row
Dim AB As Double
Dim BB As Double
DA = Range("AB" & row).Value
BB = Range("BB" & row).Value
Area = AB * BB
End Function
If someone introduces a new column before AB this code becomes absolute. I would like to know if there is a way to refer these columns by column names or assigning a unique identifier to each column and referring the same.
If someone has any idea about this, kindly comment. Thank you!!