VBA How to fetch raw numbers within a table column

Klash Ville

Board Regular
Joined
Sep 19, 2017
Messages
83
Hello everyone, I have the following situation creating me an obstacle:

I have a table column which contains words and numbers. From that same table column, is it posible to create a VBA command Selecting only the numbers within that column while ignoring everything else such as words in this case?

The final result would be a SUM of all these numbers that have been Selected.
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

MickG

MrExcel MVP
Joined
Jan 9, 2008
Messages
14,841
Try this, for column "A":-
Code:
MsgBox Application.Sum(Range("A:A").SpecialCells(xlCellTypeConstants, xlNumbers))
 

Klash Ville

Board Regular
Joined
Sep 19, 2017
Messages
83
Try this, for column "A":-
Code:
MsgBox Application.Sum(Range("A:A").SpecialCells(xlCellTypeConstants, xlNumbers))

Thank you for your answer, although, it's giving me an overflow error and I know why.

Could you provide me a fix on that code for only the visible cells within that column range please?
 

Klash Ville

Board Regular
Joined
Sep 19, 2017
Messages
83
nvm it's working now.

Code:
    Dim x As Integer
    
    x = Application.Sum(Range("E:E").SpecialCells(xlCellTypeVisible, xlNumbers))
        
    MsgBox x

Thank you so much my friend =)
 

Watch MrExcel Video

Forum statistics

Threads
1,129,754
Messages
5,638,170
Members
417,011
Latest member
Amaden95

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
Top