+ Reply to Thread
Results 1 to 3 of 3

For loop, if function - two coloumns, cell value dosent exist in column 2 copy from 1.

  1. #1
    Registered User
    Join Date
    03-14-2018
    Location
    Denmark
    MS-Off Ver
    2016
    Posts
    1

    For loop, if function - two coloumns, cell value dosent exist in column 2 copy from 1.

    Hello.

    I have a problem.

    I have around 200 unique numbers i need to copy to another column. I have copied these specific numbers 5 times so there are 1000 rows in total. These unique numbers is in column B and i need them to get copy to column F. The only restriction i need is that they have to copy the cells if they are not located in column F, if they already are there then the for loop shouldent do anything. It should be very simple but i simply cant make it work.

    Please Login or Register  to view this content.
    i also tried this.

    Please Login or Register  to view this content.
    Last edited by alansidman; 03-14-2018 at 05:57 PM. Reason: code tags added

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,616

    Re: For loop, if function - two coloumns, cell value dosent exist in column 2 copy from 1.

    The problem occurs probably because you use selection way too often (without reason to do so), and do not return to your starting column.
    See such modification:
    Please Login or Register  to view this content.
    Please edit your post to comply with Rule 3 of our Forum RULES.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Click on Edit to open your thread, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here
    Best Regards,

    Kaper

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,872

    Re: For loop, if function - two coloumns, cell value dosent exist in column 2 copy from 1.

    Code Tags Added
    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html



    (I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] VBA to loop and fill blanks with data from left column if values exist in 3 cells?
    By hopegriffin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-04-2016, 05:08 PM
  2. VBA code to consolidate coloumns in muliple sheets into multiple coloumns in one sheet?
    By BrettRCourtney in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-13-2013, 09:17 AM
  3. [SOLVED] VBA code to consolidate coloumns in muliple sheets into multiple coloumns in one sheet?
    By BrettRCourtney in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-13-2013, 06:19 AM
  4. [SOLVED] Copy dynamically changing column and Paste using VBA Loop (Loop within Loop)
    By nixon72 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-12-2013, 12:46 PM
  5. if in column a does not exist copy b to c
    By radu-balas in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 01-10-2013, 08:00 PM
  6. [SOLVED] Loop-copy cell values from a row, and then copy them into a column
    By vukovicnikola in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-15-2012, 06:03 AM

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