Bijiont
07-13-2010, 10:22 PM
Hello Everyone,
I have been lurking the forums for a while to help with several of my VB issues however this one has me scratching my head to the point I need assistance.
Here is what I am looking to do;
I need a loop that will check two ranges and if both are true add to a variable and output to another sheet.
Here is what I have so far;
For Each cell In Worksheets("sheet1").Range("C2:C351")
If Left((cell.Value), 8) = "10.24.2." Then
IPADDRESS = IPADDRESS + 1
Worksheets("IP Counts").Range("B12") = IPADDRESS
End If
NEXT
The above works great for a single range however when I try to check another range it will give random errors during debug.
Below is what my recent attempt was which doesn't work. Same for statement as above however different IF.
If (Left((cell.Value), 7) = "10.7.2.") And (MODCheck(Left((cell.Value)), 5) = "RICOH") Then
IPMOD = IPMOD + 1
Worksheets("IP Counts").Range("F12") = IPMOD
End If
I have the feeling I need to do something different with my For loop but again it works fine with a single range.
Thank you for any help you can provide, until then back to the books to figure out a solution.
I have been lurking the forums for a while to help with several of my VB issues however this one has me scratching my head to the point I need assistance.
Here is what I am looking to do;
I need a loop that will check two ranges and if both are true add to a variable and output to another sheet.
Here is what I have so far;
For Each cell In Worksheets("sheet1").Range("C2:C351")
If Left((cell.Value), 8) = "10.24.2." Then
IPADDRESS = IPADDRESS + 1
Worksheets("IP Counts").Range("B12") = IPADDRESS
End If
NEXT
The above works great for a single range however when I try to check another range it will give random errors during debug.
Below is what my recent attempt was which doesn't work. Same for statement as above however different IF.
If (Left((cell.Value), 7) = "10.7.2.") And (MODCheck(Left((cell.Value)), 5) = "RICOH") Then
IPMOD = IPMOD + 1
Worksheets("IP Counts").Range("F12") = IPMOD
End If
I have the feeling I need to do something different with my For loop but again it works fine with a single range.
Thank you for any help you can provide, until then back to the books to figure out a solution.