jeudi 10 janvier 2019

Comparing and Organizing 2 Adjacent Columns VBA

I am trying to compare 2 adjacent columns in Excel and organize them according to size. I want to compare cells A1 and B1, and if cell A1 > cell B1, switch cells A1 and B1. If cell A1 < cell B1 do nothing. I want to do this for thousands of rows, and compare the 2 cells in every row, and make adjustments accordingly with a macro. Ex.

 2    3
 4    1
 7    5

Goes to

2    3
1    4
5    7

I found a question on here that is similar: Fast compare method of 2 columns

Any help would be greatly appreciated!

This is a picture I found on the link that I am trying to build off of. It doesn’t do exactly what I want but I figured it was close to a framework for what I am trying to do! Preferably the macro won’t take a particularly long time.(https://i.stack.imgur.com/tUir8.png)

Aucun commentaire:

Enregistrer un commentaire