# Excell macro VBA Overflow (Error 6)



## enilgun (Sep 29, 2004)

I want to read an integer number from an excell cell but i couldn't. Overflow (Error 6)  

And also i could't write multiplication of n and m into any cells in following VBA commands.

Sub ReadWrite()
Dim WS As Worksheet
Dim n, m, number As Long

Set WS = ActiveWorkbook.Sheets("Sheet1")

number =WS.Cells(4, "B").Value ' number in this cell 3.234.567.891.234
n = 120.345.678
m = 12.345
WS.Cells(4, "C").Value = n*m 

End Sub


----------



## mark007 (Sep 15, 2004)

Rather than:

WS.Cells(4, "B").Value 

use:

WS.Cells(4, 2).Value 

or:

WS.Range("b4").Value 

Also note that:

Dim n, m, number As Long


declares 2 variants and a long. To declare 3 longs you need as long after each variable i.e.

Dim n as long, m as long, number As Long


----------

