How to loop through a range of cells

Lorna

New Member
Joined
Mar 12, 2009
Messages
19
I have a range of cells (L3:L10) on a sheet called Products. Each of the cells in this range gets it's value based on an IF statement. So the list may look something like this:

Item Codes
11702-71-21
0
11702-73-21
0
0
11702-76-21
0
11702-97-21

I have another sheet called Order Form and the range C:3:C10 is where I want the Items Codes on the Products sheet to be displayed. However, I only want to display on the Order Form just the fields with actual item codes. So what would be the easiest way to loop through this range and only pick out the valid item codes and disregard the cells with only a 0?

Thanks
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Hi Lorna,

You could record a macro here - how about filtering the column to exclude zero and blank values and then copying over the visible cells? This way you won't need to use a loop.

Hope that helps
 
Upvote 0
I hadn't thought of doing that...much simpler and it works just fine. Many thanks Colin.
 
Upvote 0

Forum statistics

Threads
1,214,971
Messages
6,122,517
Members
449,088
Latest member
RandomExceller01

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