I am working on an Excel 2010 worksheet that has several names of doctors and their addresses, but often there are two names that are identical but have different addresses. In this case, I would like to copy the address information into the same row as the name, but taking into account 4 columns. Here is the code I came up with
Sub OraganizadorEndereços() ActiveCell.Select If ActiveCell.Value = ActiveCell.Offset(1, 0).Value _ Then ActiveCell.Offset(1, 0).Activate: _ Range(ActiveCell.Offset(0, 1), ActiveCell.Offset(0, 4)).Copy: _ ActiveCell.Offset(-1, 0).Select: _ ActiveCell.Offset(0, 5).Paste _ Else ActiveCell.Offset(1, 0).Select End Sub
But I get an error
ActiveCell.Offset(0, 5).Paste _ Else ActiveCell.Offset(1, 0).Select
Part of the code, stating that the obeject does not accept this property / method
And remember, I started programming in VBA today, so if you can answer with an explanation, I would appreciate it.
Pedro source share