Loop through worksheet with 2 criteria

tigersden

Board Regular
Joined
Oct 5, 2005
Messages
91
Hi,
I have a worksheet which is used as a summary it shows monthly totals from an imported text file using dynamic named ranges.
I am trying to use a combo box to select a month and option buttons to enable selection of orders greater than 1000, 5000 & 10000 for that selected month.
I need help in working out how to loop through the data sheet and return all the matching values. I need to select from each row that matches the criteria, 5 different cells in that row (named ranges). These would be written back to another seperate sheet for analysis.
Thanks in advance
Tim
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Tigersden,
Here's an example of how to cycle through a range of values and act upon the value.

Code:
Dim cell as range, ws as worksheet

activeworkbook.sheets.add
set ws = activesheet

for each cell in range("NamedRange1")
   If cell > 1000 then
       cell.copy ws.range("A65535").end(xlup).offset(1,0)
   End if
Next cell
 
Upvote 0

Forum statistics

Threads
1,203,465
Messages
6,055,574
Members
444,799
Latest member
CraigCrowhurst

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