# 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

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
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``````

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

Last edited:
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``````

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``````

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.

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

Replies
6
Views
216
Replies
2
Views
182
Replies
0
Views
332
Replies
1
Views
335
Replies
11
Views
823

1,217,316
Messages
6,135,813
Members
449,965
Latest member
Ckl43

### 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.

### Which adblocker are you using?

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

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