Try this, it doesn't result in the dynamic ranges you may be looking
for but it correctly deals with any gaps in columns and any gaps in
rows, which CountA doesn't:
Sub blah()
lastcol = Cells(1, Columns.Count).End(xlToLeft).Column
For x = 1 To lastcol
lastrow = Cells(Rows.Count, x).End(xlUp).Row
If Cells(1, x) <> "" Then
With ActiveWorkbook.Names
.Add Name:=Cells(1, x).Value, _
RefersTo:="=Sheet1!" & Range(Sheets("Sheet1").Cells(2, x), _
Sheets("Sheet1").Cells(lastrow, x)).Address
End With
End If
Next x
End Sub