# Having some issues with my snippet of code...

#### eskelies

##### Board Regular
The following code keeps multiplying by a million instead of ending once the next cell is blank or has a zero. Do I need to have an offset? If so, how should it look?

Code:
``````          Set myRange = Range("B10:B20")
For Each c In myRange

If IsNumeric(c) Then
c.Value = c.Value * 1000000
Else
c.Value = ("")
End If
Next
For Each cell In [B11:B20]
If cell.Value = "0" Then cell.ClearContents
Next cell
Next

Range("A10:G20").Copy Destination:=Sheets("Sheet2").Range("H11")``````

any help would be useful.

### Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

#### xld

##### Banned
Code:
``````    For Each c In myRange

If c.Value <> "" Then

If IsNumeric(c.Value) Then
c.Value = c.Value * 1000000
Else
c.Value = ("")
End If
End If
Next``````

#### eskelies

##### Board Regular
nothing changed on this. It increases exponentially by a million instead of only increasing by a million once.

Last edited:

#### xld

##### Banned
If you REALLY want to end

Code:
``````    For Each c In myRange

If c.Value <> "" Then

If IsNumeric(c.Value) Then
c.Value = c.Value * 1000000
Else
Exit For
End If
End If
Next``````

#### eskelies

##### Board Regular

Still isn't working properly. I'm getting exponentials to the 279th power.

If you REALLY want to end

Code:
``````    For Each c In myRange

If c.Value <> "" Then

If IsNumeric(c.Value) Then
c.Value = c.Value * 1000000
Else
Exit For
End If
End If
Next``````

#### Saffa84

##### New Member
The following code keeps multiplying by a million instead of ending once the next cell is blank or has a zero. Do I need to have an offset? If so, how should it look?

Code:
``````          Set myRange = Range("B10:B20")
For Each c In myRange

If IsNumeric(c) Then
c.Value = c.Value * 1000000
Else
c.Value = ("")
End If
Next
For Each cell In [B11:B20]
If cell.Value = "0" Then cell.ClearContents
Next cell
Next

Range("A10:G20").Copy Destination:=Sheets("Sheet2").Range("H11")``````

any help would be useful.
You original code works fine for me if I take out the extra "Next" at the end.

#### eskelies

##### Board Regular
Unfortunately for me it continuously multiplys by 1mm. Now it could be because that was only part of the code.

### Forum statistics

1,106,595
Messages
5,512,304
Members
408,886
Latest member
kashifziatevta423