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

build macros that checks the value inside the cell with other cell

asafraz81

Member
hi,

i'm trying to define macro that check cell.value and compare it to other cell.

i get an eror that object required/

please help...

Sub checkcells()

Dim cell As Range

Dim x As Range

For Each cell In Range("a1:a2")

For Each x In Range("c1:c2")

If cell.Value = x.Value Then

MsgBox o.k

End If

Next x

Next cell

End Sub
 
Hi asafraz81,


I can't say anything regarding rest of the macro but if you do this:


Code:
MsgBox "o.k"


You can (hopefully) avoid mentioned error.


Regards,
 
If this solves your error, not that there are more efficient ways to check if a cell exists. You could use the
Code:
.Find
method, or a worksheet function of COUNTIF or MATCH, which would be faster than looping through all the cells. Just a thought...
 
what i need to do is, to compare cells and to see if they have the same value.

this code run on cells and chek if they have the same value.

i you guys have a faster or a beter ways i will glad to a add smarter way to do this.


thanks again.

asaf
 
Hi, asafraz81!

Consider uploading a sample file (including manual examples of desired output), it'd be very useful for those who read this and might be able to help you. Thank you.

Give a look at the second green sticky post at this forums main page for uploading guidelines.

Regards!
 
Back
Top