How to Create a Header Row
It worked! Thanks for your help, Kevin. And thanks for taking the time to
consider my problem, Jim.
--
Dan
"Kevin B" wrote:
If you don't want the row numbers you can run this code instead:
Sub ColumnHeadings()
Dim varVal As Variant
Dim strAddress As String
ActiveSheet.Range("A1").Select
ActiveCell.EntireRow.Insert
varVal = ActiveCell.Offset(1).Value
Do Until varVal = ""
strAddress = Application.ConvertFormula( _
"R" & ActiveCell.Row & "C" & ActiveCell.Column, _
xlR1C1, xlA1, xlRelative)
If Len(strAddress) = 3 Then
strAddress = Left$(strAddress, 2)
Else
strAddress = Left$(strAddress, 1)
End If
ActiveCell.Value = strAddress
ActiveCell.Offset(0, 1).Select
varVal = ActiveCell.Offset(1).Value
Loop
End Sub
--
Kevin Backmann
"DevDaniel" wrote:
I have a set of data without headers. I want to programmatically insert a
blank row into Row 1, then add a header (e.g., the column letter) for each
column in the data range.
|