Create new function in Excel

ssingh75

Well-known Member
Joined
Jan 5, 2012
Messages
518
Good noon to All,

Can anyone help me to create a function to remove number from column A in Excel.
e.g., Create a new function called "NoNumber"


Susheel
Excel,Access - 2007
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Maybe this

Code:
Sub NoNumber()
Columns("A").SpecialCells(xlCellTypeConstants, xlNumbers).ClearContents
End Sub
 
Upvote 0
What would the data in column A look like? What would you like to be left with?

Thanks
Adam
 
Upvote 0
Thanks!

But i am looking for the function which i can apply for any column in Sheet.

Susheel
Excel,Access - 2007
 
Upvote 0
Try

Code:
Sub NoNumber()
Dim r As Range
Set r = Application.InputBox("Click in the column", Type:=8)
r.EntireColumn.SpecialCells(xlCellTypeConstants, xlNumbers).ClearContents
End Sub
 
Upvote 0
Thanks!

But again i am not satisfied...As i said i am looking for the function.

like..Sum, Product, etc.

NoNumber should be as same to apply any cell of Activeworkbooks worksheet.

Susheel
Excel,Access - 2007
 
Upvote 0
A function can only return a value to the cell that it is called from. It cannot change the Excel environment.
 
Upvote 0
I think their is some confusion...Let me explain

Cell A1 contain "Abha123Y9" as text with number

If i use the function say Nonumber then it will only return me Abhay as ans
e.g.
=Nonumber("Abha123y9")
Ans: Abhay

Hope this will help for better understanding.

Susheel
Excel,Access - 2007
 
Upvote 0
Try

Code:
Function NoNumber(r As Range) As String
Dim i As Long
For i = 1 To Len(r.Value)
    If Asc(Mid(r.Value, i, 1)) < 48 Or Asc(Mid(r.Value, i, 1)) > 57 Then NoNumber = NoNumber & Mid(r.Value, i, 1)
Next i
End Function

Excel Workbook
ABC
1Abha123Y9AbhaY
Sheet3
 
Upvote 0

Forum statistics

Threads
1,223,748
Messages
6,174,264
Members
452,553
Latest member
red83

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