Deleting column based off special character

aka_krakur

Active Member
Joined
Jan 31, 2006
Messages
438
I have a spreadsheet that is brought in by a comma delimin drill down (an online Intranet tool at my work).
This is pretty much how it looks (minus the bolded columns; I made them bold to emphasize the columns I want to delete)
I want a simple button driven macro that automatically deletes columns based off of if Row 3 does not contain a "/" I've done it before on rows, but I looked at the code and couldn't figure out how to tweak with it for use with columns.

here's my example:

[HTML removed by admin]
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Hi,

perhaps this ?
Code:
Sub test()

Dim LC As Integer
Dim i As Integer

LC = Cells(3, Columns.Count).End(xlToLeft).Column

Application.ScreenUpdating = False

    For i = LC To 1 Step -1
    If InStr(1, Cells(3, i), "/") = 0 Then Cells(3, i).EntireColumn.Delete
    Next i

Application.ScreenUpdating = True

End Sub
kind regards,
Erik
 
Upvote 0
Worked except somehow it even deleted Column 1 (which contains the part nos.) Need to keep that.
step through code using key F8 & see what happens
you'll find where to edit
possibly without internet-connection within 2 hours till 22th sept
 
Upvote 0

Forum statistics

Threads
1,214,834
Messages
6,121,874
Members
449,056
Latest member
ruhulaminappu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top