This first bit of code will work providing that x is found nowehere else in the sheet except in the column next to the data you want to transfer
Sub TransferAgain()
Dim LastRow As Long
Dim nextrow As Long
Dim rWhatToFind
LastRow = Application.WorksheetFunction.CountA(Range("A:A"))
Cells.Find(What:="X").Activate
rWhatToFind = ActiveCell.Address
Do
nextrow = Application.WorksheetFunction.CountA(Range("C:C")) + 1
ActiveCell.Offset(0, -1).Copy Cells(nextrow, 3)
Cells.FindNext(After:=ActiveCell).Activate
Loop Until ActiveCell.Address = rWhatToFind
End Sub
This is a slightly modified version which restricts the search range to just the column next to the data so will work if x can be found elsewhere in the speardsheet.
Sub TransferData()
Dim rFindWhere As Range 'Where to look up details
Dim rFindWhat As Variant 'What to look for in range
Dim rWhatToFind
Dim LastRow As Long
Dim nextrow As Long
LastRow = Application.WorksheetFunction.CountA(Range("A:A"))
Set rFindWhere = Range(Cells(1, 2), Cells(LastRow, 2))
rFindWhat = rFindWhere.Find(What:="X").Activate
rWhatToFind = ActiveCell.Address
Do
nextrow = Application.WorksheetFunction.CountA(Range("C:C")) + 1
ActiveCell.Offset(0, -1).Copy Cells(nextrow, 3)
Cells.FindNext(After:=ActiveCell).Activate
Loop Until ActiveCell.Address = rWhatToFind
End Sub
Just change the column references as needed.
Hope this helps, Robyn
Bookmarks