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

using for each cell loop

macro_learning

New Member
Hi,

Can anyone please correct below code,

Sub trying_foreachcell_loop()

On Error Resume Next

Dim rng As Range

rng = Application.InputBox(" select rang", Type:=8)

For Each cell In rng

cell = VBA.Sqr(cell)

Next cell

End Sub
 
Hi ,

Same problem !

Use :

Set rng = Application.InputBox(" select rang", Type:=8)

When assigning a value to a range variable , you need to use :

rng.Value = Something

When assigning a range to a range variable , you need to use :

Set rng = Something

Narayan
 
Back
Top