incrementing by 1

L

Legacy 4302

Guest
hi

For Each cl In [Sheet2!A1:C5]
tmpvalue = cl.value
if tmpvalue = 0 then tmpvalue=10
Worksheets("SHEET3").Cells(tmpvalue, cl.Column) = "1"
Next cl


this formula works great. Sheet 2 column A has: cell a1=2,cell a2=4,and cell a3=0 then sheet 3 column A has: a2="1", cell a4="1" and cell a10="1"
which is correct however the problem is if sheet 2 column a has:
cell a1= 3,cell a2=3 ,and a3=4
then sheet three column A should be cell a3="2" and cell a4="1"

so in other words if sheet 2 has duplicating numbers in the column then
for each instance of a duplicate number ,cl.value would have to be incremented by 1

thanks for any help

lneilson
 

Some videos you may like

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Watch MrExcel Video

Forum statistics

Threads
1,123,108
Messages
5,599,767
Members
414,336
Latest member
Nicolas2465

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
Top