Delete text from column C

Abhishekghorpade

Board Regular
Joined
Oct 3, 2018
Messages
78
Hi,

Please give me macro to delete all text from column C... I have cells with numbers that should be untouched.

Thanks
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
This is a function that returns only numbers...
Code:
Function NumbersOnly(r As Range) As String' NumbersOnly Macro
vOut = ""
vStr = r.Formula
For i = 1 To Len(vStr)
  If Mid(vStr, i, 1) >= "0" And Mid(vStr, i, 1) <= "9" Then
    vOut = vOut & Mid(vStr, i, 1)
  End If
Next
NumbersOnly = vOut
End Function
 
Upvote 0
Please give me macro to delete all text from column C... I have cells with numbers that should be untouched.
Assuming the values in Column C are constants (that is, they are not formulas), give this macro a try...
Code:
Sub ClearTextCellsFromColumnC()
  Columns("C").SpecialCells(xlConstants, xlTextValues).ClearContents
End Sub
 
Upvote 0
Yes there is no formulas in column C... There are multiple duplicates in column C.. Can macro copy unique values and paste it in new sheet1..
 
Upvote 0
Yes there is no formulas in column C... There are multiple duplicates in column C.. Can macro copy unique values and paste it in new sheet1..
:confused: How does this relate to the original question? Did the macro I posted do what you asked for?
 
Upvote 0
From the numbers that remain in column c
I am not sure what you meant by "new Sheet1" in Message #5 , so I simply put it on Sheet1 starting at cell A1. See if this does what you want...
Code:
Sub UniqueNumbersInColumnC()
  Dim R As Long
  With CreateObject("Scripting.Dictionary")
    For R = 1 To Cells(Rows.Count, "C").End(xlUp).Row
      If Len(Cells(R, "C").Value) Then .Item(Cells(R, "C").Value) = 1
    Next
    Sheets("Sheet1").Range("A1").Resize(.Count) = Application.Transpose(.Keys)
  End With
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,816
Members
449,049
Latest member
cybersurfer5000

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