ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Write variables from a loop, once only (https://www.excelbanter.com/excel-programming/342422-write-variables-loop-once-only.html)

Novaloc

Write variables from a loop, once only
 
Hi,
I'm working with WinXP Pro and Excel 2003.
In brief.
I have Column A2:A22 with cabinet codes and Column B2:B22 with component
codes relating to the cabinet code. ie cabinet code is L5, component code is
6E. (This is calculated with some other code.)
Many cabinet codes will have component code 6E. Other cabinets will have
different component codes.
What I require is to loop through the Col B, find what the component code is
and write it to Col A40 using .End(xlUp), if there are multiples tho I need
to only write it once, this is where the brain is stumped. I just can't
figure out how to tell Excel to only write a component code once and then
carry on writing the other codes.

Is it possible?

Regards

Richard



Tushar Mehta

Write variables from a loop, once only
 
No need for loops. Use XL's advanced filter capability (Data | Filter
Advanced Filter...) It includes the ability to extract unique values

and save them in another location.

If you must use code, turn on the macro recorder, do the filter bit
using the UI, turn off the recorder and XL will give you the necessary
code.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
Hi,
I'm working with WinXP Pro and Excel 2003.
In brief.
I have Column A2:A22 with cabinet codes and Column B2:B22 with component
codes relating to the cabinet code. ie cabinet code is L5, component code is
6E. (This is calculated with some other code.)
Many cabinet codes will have component code 6E. Other cabinets will have
different component codes.
What I require is to loop through the Col B, find what the component code is
and write it to Col A40 using .End(xlUp), if there are multiples tho I need
to only write it once, this is where the brain is stumped. I just can't
figure out how to tell Excel to only write a component code once and then
carry on writing the other codes.

Is it possible?

Regards

Richard





All times are GMT +1. The time now is 01:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com