Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Delete named columns macro help
Name: Amnesiac Date: April 16, 2009 at 16:33:12 Pacific OS: Windows XP Subcategory: Microsoft Office
Comment:
I need to write a macro in excel that will delete every column with the header name in the first row of "NAME ME." This is a task that will need to be completed many times and the columns to be deleted are not always the same. How would I do this and is it even possible?
Name: DerbyDad03 Date: April 16, 2009 at 19:26:27 Pacific
Reply:
Sub NoNameMe()
'Find last column with data in Row 1
lastCol = Cells(1, Columns.Count).End(xlToLeft).Column
'Loop through columns, starting at the last one
For delCol = lastCol To 1 Step -1
'Delete columns with Name Me in Row 1
If Cells(1, delCol) = "Name Me" Then _
Cells(1, delCol).EntireColumn.Delete
Next
End Sub
Summary: I have an xls file with alot of client info. One of the fields is a 2 char country field. I have another xls file that has the two char xls files in one field and in the next field it has the full cou...
Summary: Hello, I need some help setting up a macro for Excel. Situation: I have a list of IDs/SKUs on Sheet1, and a partial list on Sheet2. What I would like to do is cross-check the two sheets and delete all...
Summary: Sorry, I am new to Macros. I am right clicking on the column to delete. I have since gotten my macro to work, as long as I don't use a macro to delete the columns. I am not familiar with VBA. Can I...