I have an excel spread sheet that has account information for users. There are multiple occurrences of a value in column B that say "Account Name:" and I need to copy the value that is next to it in Row D and paste it in Column A of a different worksheet in that workbook called Data. I need to repeat this in a range from B1:B20000. I cant get it to move past the first occurrence of the value "Account Name:" and I also don't know how to make it check to see if there is value in the first cell on the worksheet called Data is blank to paste that value into.
PHP:
Dim aN As RangeSet aN = Range("B1:B20000")
'Loop through every used cell in the active worksheet
For Each aN In ActiveSheet.UsedRange
If ActiveCell = "Account Name:" Then
ActiveCell.Offset(0, 2).Select
ActiveCell.Copy
Sheets("Data").Select
ActiveCell.PasteSpecial
Sheets("Table4").Select
ActiveCell.Offset(0, -2).Select
Else: ActiveCell.Offset(1, 0).Select
End If
Next
End Sub