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


Sample Data

Output :
List Names / Range Names


No comments:

Post a Comment

Hi User, Thank You for Visiting My Blog. Please Post Your Feedback/Comments/Query.

Subscribe to Blog Posts by Email

ExcelKingdom-Popular Posts

ExcelKingdom-Random Posts