I have a (large) table with row and column headers of the following format: table with row and column headers
I'd like to set the cells marked with 'x' to a concatenation of the column header and the row header, separated by a comma. For example, cell B2 should be set to "c1_HEADER, r1_HEADER".
Is there a formula I can use to achieve this? At least by clicking the 'x' marked cells and applying the formula? I'd hate to take the manual route all the way :/.
TIA.
If we start with:
running this macro:
Sub luxation()
Dim r As Range
For Each r In Range("B2").CurrentRegion
If r.Value = "x" Then
r.Value = r.EntireColumn.Cells(1).Value & "," & r.EntireRow.Cells(1).Value
End If
Next r
End Sub
will produce:
Note:
in this macro Range("B2").CurrentRegion
represents the block of cells that we are looping through. The variable r
is a single-cell range that facilitates the loop.