+ Reply to Thread
Results 1 to 2 of 2

Write variables from a loop, once only

  1. #1
    Novaloc
    Guest

    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



  2. #2
    Tushar Mehta
    Guest

    Re: 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 <[email protected]>,
    [email protected] 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
    >
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1