View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
GS[_6_] GS[_6_] is offline
external usenet poster
 
Posts: 1,182
Default Search specific columnheading and copy/insert this column to location column A

A more brief version...

Sub MoveColumn2()
Dim c As Range

Set c = ActiveSheet.Range("1:1").Find("ABCD", lookat:=xlPart)
If Not c Is Nothing Then
If c.Column = 1 Then
MsgBox "Heading 'ABCD' is already in column A", vbInformation
Else
Columns(c.Column).Cut: Columns(1).Insert Shift:=xlToRight
MsgBox "Heading 'ABCD' was found and moved to column A", vbInformation
End If
Else
MsgBox "Heading 'ABCD' does not exist", vbExclamation
End If
End Sub

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion