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

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Try this, for column "A":-
Code:
MsgBox Application.Sum(Range("A:A").SpecialCells(xlCellTypeConstants, xlNumbers))
 
Upvote 0
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?
 
Upvote 0
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 =)
 
Upvote 0

Forum statistics

Threads
1,214,812
Messages
6,121,704
Members
449,048
Latest member
81jamesacct

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