Hi guys,
I've been working on a small vba macro that will swap the values in column a and b if column a is greater.
I already came up with the code to swap values between two cells...but I need this code to work for the whole column of a and b. I suppose I need a loop...can someone help me with this? I appreciate it.
here is my existing code.
I've been working on a small vba macro that will swap the values in column a and b if column a is greater.
I already came up with the code to swap values between two cells...but I need this code to work for the whole column of a and b. I suppose I need a loop...can someone help me with this? I appreciate it.
here is my existing code.
Code:
Sub Transpose()
Dim column1 As Integer
Dim column2 As Integer
column1 = Range("A1").Value
column2 = Range("B1").Value
If column1 > column2 Then
Range("A1").Value = Range("B1").Value
Range("B1").Value = column1
Else: MsgBox "Completed"
End If
End Sub