Delete Cells in column

omegadeltaphi

New Member
Joined
Jul 10, 2011
Messages
30
Please Help :)

I have an excel file where i have unnecessary information. So I would like to delete all the cells I dont need. They are all similiar in that they are (3 characters) long. ex................. (B!T, DVA, M2A, N&T) just like that. All of them are three chars. The rest of my data in other fields is much longer so maybe i can use come kind of condition <3 something or rather???????????????


Im not proficient in code. I have been digging all day to no avail.

Please help, Thanks in Advance

Steve
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Hi Steve,

Welcome to MrExcel!!

Couple of initial questions:

Which column(s) contains the data and what row does the data start from?

Robert
 
Upvote 0
It is just one column (a) and thousands of rows (3000). Most of the rows in the column have useful data but 20% of it is useless.

I hope that answers your question?

Thanks Robert

Steve
 
Last edited:
Upvote 0
Though you didn't answer what row the starts from, try this (which starts from Row 2 - change to suit):

Code:
Sub Macro1()

    Dim rngCell As Range
    
    Application.ScreenUpdating = False
    
    For Each rngCell In Range("A2:A" & Range("A" & Rows.Count).End(xlUp).Row)
        If Len(rngCell.Value) = 3 Then
            rngCell.ClearContents
        End If
    Next rngCell
    
    Application.ScreenUpdating = True

End Sub

Note too that as the code will be clearing data, make sure to initially run it on a copy of your data in case the results are not as expected.

Regards,

Robert
 
Upvote 0
Here is a short and fast macro to do what you asked...

Code:
Sub ClearThreeCharacterCells()
  Columns("A").Replace "???", "", xlWhole
End Sub
Just to point out, though, that you can do this with Excel's built-in Replace functionality. Select Column A and then press CTRL+H to bring up the Replace dialog box. Type ??? in the "Find what" field, make sure the "Replace with" field is empty. Click the "Options>>" button in order to see all the options available to you (assuming they are not already displayed). Make sure the "Match entire cell contents" checkbox has a check mark in it, then click the "Replace All" button.
 
Upvote 0
Here is a short and fast macro to do what you asked...

Code:
Sub ClearThreeCharacterCells()
  Columns("A").Replace "???", "", xlWhole
End Sub
Just to point out, though, that you can do this with Excel's built-in Replace functionality. Select Column A and then press CTRL+H to bring up the Replace dialog box. Type ??? in the "Find what" field, make sure the "Replace with" field is empty. Click the "Options>>" button in order to see all the options available to you (assuming they are not already displayed). Make sure the "Match entire cell contents" checkbox has a check mark in it, then click the "Replace All" button.

Nice. I like that one. Good to know.
 
Upvote 0
Hey John, I see you are from New Jersey also. Anywhere near central NJ by any chance? You can answer me via email so we don't clutter up this thread with an off-topic subthread.

rickDOTnewsATverizonDOTnet

just replace the upper case letters with the symbols they spell out.
 
Upvote 0

Forum statistics

Threads
1,224,595
Messages
6,179,798
Members
452,943
Latest member
Newbie4296

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