|
-
Mar 14th, 2012, 10:41 AM
#1
Thread Starter
Addicted Member
compare one cell
how do compare cell in work sheet to another cell in another sheet in vba macro excel 2003
thanks
-
Mar 14th, 2012, 11:12 AM
#2
Thread Starter
Addicted Member
Re: compare one cell
Sub macro1()
Dim rng As Range
Dim md1 As Integer
For Each rng In Range("B2:B256")
For Each rng1 In Range("G2:G3000")
If (Sheets("Sheet1").Cells(rng.Row, 2).Value) = Sheets("Sheet2").Cells(rng1.Row, 7).Value Then
MsgBox (rng)
md1 = md1 + 1
MsgBox md1
End If
Next
Next
End Sub[/COLOR][/COLOR][/COLOR][/COLOR]
-
Mar 15th, 2012, 05:09 AM
#3
Re: compare one cell
it would be advantageous to use excel's find (and findnext) method to do this
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|