Count used cells, in a specific range...

S

Steff_DK

I want to count the number of cells in the range 'case' that contain
numbers... (or contains anything for that matter...)


This one gives 'error 6 overflow' maybe because it counts all cells i
the range.

iTest = Workbooks("Projekt
Function").Worksheets("data").Range("case").Count

Thanks

Stef
 
F

Frank Kabel

Hi
try something like the following:
sub foo()
dim ret_value
dim rng as range
set rng = Workbooks("Projekt TFunction").Worksheets
("data").Range("case")
ret_value = application.worksheetfunction.COUNTA(rng)
msgbox ret_value
end sub
 
P

Paul

Hi,

try this

Sub Test()
dim Rng as range
dim CellCount as long

set Rng = Workbooks("Projekt
TFunction").Worksheets("data").Range("case")
CellCount = Application.Worksheetfunction.COUNTA(Rng)

....
End Sub


Regards

Paul
 
Top