My question has been answered over and over but I don't understand the solutions and therefore can't customize them to fit my needs.
Here's a link to a solution on StackOverflow Loop through each row of a range in Excel.
Dim rng As Range
Dim row As Range
Dim cell As Range
Set rng = Range("A2:b22")
For Each row In rng.Rows
For Each cell in row.Cells
'Do Something
MsgBox cell
Next cell
Next row
Here's my code that should go inside the loop. It should take the value of the first column, copy the data, then take the valule of the 2nd column and paste the data.
What it's doing is using the same value from the 1st column. So at what point does the value of CELL change to B2 from A2?
Windows("UnitedOrig.xlsx").Activate
Sheets(CurYearTxtPRAC).Select
Range("A4:U4").Select
ColumnFROM = MyColumnLetter(Cells.Find(What:=cell, After:=ActiveCell,
LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False).Column)
Range(ColumnFROM & "5:" & ColumnFROM & LastRowPRAC).Select
Selection.Copy
Windows("United.xlsx").Activate
Sheets("PRACS").Select
Range("A1:U1").Select
ColumnTO = MyColumnLetter(Cells.Find(What:=cell, After:=ActiveCell,
LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False).Column)