+ Reply to Thread
Results 1 to 3 of 3

Copy data from a column based on conditional logic

  1. #1
    Registered User
    Join Date
    03-20-2020
    Location
    Minnesota, USA
    MS-Off Ver
    Office 365
    Posts
    9

    Lightbulb Copy data from a column based on conditional logic

    I just learned about VBA and Macros. I was able to make minor adjustments but I am struggling to figure out the conditional logic. Here is my example


    Col A | Col B | Col C
    123 | Manual |
    232 | Automated | filename
    334 | Manual |
    I want to be able to loop through Col B, find cells that have Manual listed, upon match take value from Col A and paste it in Col C. If not, then leave the existing value. I tried the following but its not dynamic and maybe not the best conditional code to use in this scenario. I am thinking For each would be ideal? Any suggestions?

    If Range("B2").Value = "Manual" Then
    ActiveCell.Range("C2").Value = Range("A2").Value
    End If

  2. #2
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    2007
    Posts
    3,314

    Re: Copy data from a column based on conditional logic

    Hi there,

    Try this while on the sheet with the data:

    Please Login or Register  to view this content.
    Please also use the correct tags when posting code. You've used the quote tags.

    Thanks,

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  3. #3
    Registered User
    Join Date
    03-20-2020
    Location
    Minnesota, USA
    MS-Off Ver
    Office 365
    Posts
    9

    Re: Copy data from a column based on conditional logic

    I just figured it out. Using the following code

    Please Login or Register  to view this content.

+ 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. Replies: 7
    Last Post: 03-10-2017, 02:20 AM
  2. [SOLVED] Modify a column of data with a logic argument, copy paste down etc..
    By D.Lovell in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-01-2015, 02:22 PM
  3. Simple copy pest data with logic
    By arindamsenaxa in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-12-2015, 02:29 AM
  4. Macro to do logic based on other column
    By arnab0711 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-26-2011, 09:00 AM
  5. Autofill one column based on another column using a certain logic
    By arnabarnab in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-09-2009, 02:38 AM
  6. Replies: 2
    Last Post: 08-09-2009, 12:58 AM
  7. Conditional logic based on name of worksheet
    By jartzh in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-24-2009, 04:49 PM

Tags for this Thread

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