Sunday, 20 January 2013

How to Convert Column Headings as List Names or Range Names with Excel VBA Macro

Excel VBA Macro To Create List Names  or Range Names with Column Headings as they refers List Names for Respective Columns
Sub ColHeaderAsList()
Dim X As Long
Dim Y As Long
On Error Resume Next
Y = ActiveSheet.Columns.Count

For X = 1 To Y    'You can reduce this loop size as you wish
If Cells(1, X) <> "" Then Cells(1, X).EntireColumn.Select
Selection.Name = Cells(1, X).value
Next X

MsgBox "List Names are Created With Columns Headings", , "Successfull !!!"
End Sub

Example:

Sample Data



Output :
List Names / Range Names






Regards,
TAMATAM


No comments:

Post a Comment

Follow Me by Email

ExcelKingdom-Popular Posts

ExcelKingdom-Random Posts