• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Run Time Error : 13 -Type Mismatch-Mostly face in Any module with For-Each- Next loop

Dear Sir,

Run Time Error : 13
Type Mismatch

on - cell.Value = cell.Value * cell.Value

Code:
Sub RangeMultiplyer_Click()

Dim rng As range
Dim cell As range

Set rng = range("A1:A10")
'you can Set rng = Selection

For Each cell In rng
cell.Value = cell.Value * cell.Value
Next cell

End Sub

This type of error mostly face in any module
which have For Each next loop

if firm method available as a how this type of loop handle
I can change it in many modules
to work smoothly...

please help

Chirag Ravel
 
I'm not sure what your issue is because the code works fine for me

I would change it to
Code:
Sub RangeMultiplyer_Click()

Dim rng As Range
Dim cell As Range

Set rng = Range("A1:A10")
'you can
'Set rng = Selection

For Each cell In rng
  cell.Value = cell.Value ^ 2
Next cell

End Sub
 
Dear Sir,

Thanks for your reply ...
its working now...but before your code..its working but at last this error always appear. may be ..I have many modules in my project can conflict it?

one another point
please give your opinion

"we must set "Nothing" in any module after complete the procedure.. if we previously set Objects?" otherwise they remains in the memory? and can generate conflict between modules?

Regards,
Chirag Raval
 
Back
Top