作者:大布丁 | 来源:互联网 | 2023-05-19 06:56
ImworkingonaExcel2010Sheetthathassomedoctorsnamesandtheiradresses,butfrequentlythe
I'm working on a Excel 2010 Sheet that has some doctors names and their adresses, but frequently there are 2 names that are identical but have diferent adresses. On this cases I would like to copy the adress info to the same row as the first name but wit h an offset of 4 collumns. Heres the code I came up with
我正在写一份Excel 2010表格,上面有一些医生的名字和他们的副词,但通常有两个名字是相同的,但都有不同的副词。在这种情况下,我想将adress info复制到与第一个名字相同的行中,但也就是4个集合的偏移量。这是我想出的密码
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 on the
但是我得到了一个错误
ActiveCell.Offset(0, 5).Paste _
Else ActiveCell.Offset(1, 0).Select
Part of the code, saying that the obeject does not accept this property/method
代码的一部分,说obeject不接受这个属性/方法
And remember, I started programing in VBA today, so if you can answer with an explanation, I would appreciate.
记住,我今天开始在VBA编程,如果你能给我一个解释,我会很感激。
2 个解决方案