Loop with two arguments

vck2017

New Member
Joined
Jan 13, 2017
Messages
8
Hello, I am using a loop function to select a range of rows with x marked in two columns, i.e. with two conditions. I have tried many different things putting an And function but noting works. I highly appreciate if anyone can advise


Code:
    If ActiveSheet.ToggleButton1 = True Then
    
    For Each c1 In Range(Cells(StartR, 2), Cells(StartR + Size - 1, 2)) And For Each c1 In Range(Cells(StartR, 2), Cells(StartR + Size - 1, 2))

    If c1.Value = "x" Then
    c1.EntireRow.Hidden = False
    If Rng Is Nothing Then Set Rng = c1 Else Set Rng = Union(Rng, c1)
    End If
    Next c1
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Hello,

You could make your life somewhat easier by using AutoFilter ...

Hope this will help
 
Upvote 0

Forum statistics

Threads
1,224,747
Messages
6,180,708
Members
452,994
Latest member
Janick

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top