Pages

Monday, February 20, 2012

Dim r As Range

Set r = Rows(1).Find(What:="YourColumnName",LookIn:=xlValues,LookAt:=xlWhole)

'check if found:
If Not r Is Nothing Then
'found so insert:
r.EntireColumn.Insert 'inserts column to left, r.Offset(,1).EntireColumn.Insert to insert to right
Else
MsgBox "Column name not found!"
End If

0 comments:

 

site weekly hits