Home > Blockchain >  Is there a VBA code that check and moves values from A column to the beginning of B column?
Is there a VBA code that check and moves values from A column to the beginning of B column?

Time:02-02

I found a lot of formulas on the Internet which copies "n characters" but they did not provide a solution for me. I am searching for a VBA code which is able to move the specific value from a column to the beginning of adjacent column. For example, the VBA code will check the A column for the word "Warm" and "Cold", and if they are available, it will move them as shown in the example. Thank you in advance for your help.

Example

Edit ( Solution by @Dominique ): =IF(A1<>"";IF(RIGHT(A1;4)="Warm";"Warm "&B1;B1))

CodePudding user response:

You can't move a part of one cell to another. This is what you need to do:

  • Search for " Warm" (or " Cold") in a cell in column A and replace " Warm" (or " Cold") by an empty string within that cell.
  • Take the cell, next to that (use the Offset() function) and add the word "Warm " (or "Cold ") at the beginning of that cell.
  • Do this for the entire A column.
  •  Tags:  
  • Related