Issue: I'm trying to swap ranges (4 adjacent cells) within a row.
For example: My spreadsheet contains student data - each student has a primary guardian and a secondary guardian. In some cases the primary guardian is listed in the secondary guardian column and needs to be swapped with the secondary guardian which is listed in the primary column. I have a column that returns a true/false value when this is the case and a change needs to be made.
I'm looking for code that does the following:
1) look at column B - skip if value is "True" , execute the following commands if value is "False"
2) if value in column B = "False" then copy cells C3:F3 and swap with H3:K3
I've been playing with the following code:
Sub SwapCells()
Dim start1 As Range
Dim start2 As Range
Dim finish1 As Variant
Dim finish2 As Variant
Set start1 = Application.InputBox(Prompt:="Please Select a Range", Title:="InputBox Method", Type:=8)
Set start2 = Application.InputBox(Prompt:="Please Select a Range", Title:="InputBox Method", Type:=8)
finish1 = start1.Value
finish2 = start2.Value
If start1.Cells.Count <> start2.Cells.Count Then
MsgBox " Please select a matching number of cells"
Exit Sub
Else:
start1.Value = finish2
start2.Value = finish1
End If
End Sub
Any help is appreciated! Thanks!
Bookmarks