|
看看是否要这个效果?
Private Sub Worksheet_Change(ByVal targer As Range)
Dim rng As Range
On Error Resume Next
Sheets("单表").Select
If Sheets("社区档案查询").[d11].Click Then
y = Sheets("社区档案查询").[d11].Value
With Sheets("基础信息")
Set rng = Sheets("基础信息").Range("c4:c33").Find(What:=y)
myAddress = rng.Address
Sheets("单表").Cells(4, 3).Value = rng.Offset(0, 1).Value
Sheets("单表").Cells(5, 3).Value = rng.Offset(0, 2).Value
Sheets("单表").Cells(6, 3).Value = rng.Offset(0, 3).Value
Sheets("单表").Cells(7, 3).Value = rng.Offset(0, 4).Value
Sheets("单表").Cells(8, 3).Value = rng.Offset(0, 5).Value
Sheets("单表").Cells(9, 3).Value = rng.Offset(0, 6).Value
Sheets("单表").Cells(10, 3).Value = rng.Offset(0, 7).Value
Sheets("单表").Cells(11, 3).Value = rng.Offset(0, 8).Value
Sheets("单表").Cells(12, 3).Value = rng.Offset(0, 9).Value
Sheets("单表").Cells(13, 3).Value = rng.Offset(0, 10).Value
Sheets("单表").Cells(14, 3).Value = rng.Offset(0, 11).Value
Sheets("单表").Cells(15, 3).Value = rng.Offset(0, 12).Value
Sheets("单表").Cells(16, 3).Value = rng.Offset(0, 13).Value
Sheets("单表").Cells(17, 3).Value = rng.Offset(0, 14).Value
Sheets("单表").Cells(18, 3).Value = rng.Offset(0, 15).Value
Sheets("单表").Cells(19, 3).Value = rng.Offset(0, 16).Value
Sheets("单表").Cells(4, 4).Value = rng.Offset(1, 1).Value
Sheets("单表").Cells(5, 4).Value = rng.Offset(1, 2).Value
Sheets("单表").Cells(6, 4).Value = rng.Offset(1, 3).Value
Sheets("单表").Cells(7, 4).Value = rng.Offset(1, 4).Value
Sheets("单表").Cells(8, 4).Value = rng.Offset(1, 5).Value
Sheets("单表").Cells(9, 4).Value = rng.Offset(1, 6).Value
Sheets("单表").Cells(10, 4).Value = rng.Offset(1, 7).Value
Sheets("单表").Cells(11, 4).Value = rng.Offset(1, 8).Value
Sheets("单表").Cells(12, 4).Value = rng.Offset(1, 9).Value
Sheets("单表").Cells(13, 4).Value = rng.Offset(1, 10).Value
Sheets("单表").Cells(14, 4).Value = rng.Offset(1, 11).Value
Sheets("单表").Cells(15, 4).Value = rng.Offset(1, 12).Value
Sheets("单表").Cells(16, 4).Value = rng.Offset(1, 13).Value
Sheets("单表").Cells(17, 4).Value = rng.Offset(1, 14).Value
Sheets("单表").Cells(18, 4).Value = rng.Offset(1, 15).Value
Sheets("单表").Cells(19, 4).Value = rng.Offset(1, 16).Value
Sheets("单表").Cells(4, 5).Value = rng.Offset(2, 1).Value
Sheets("单表").Cells(5, 5).Value = rng.Offset(2, 2).Value
Sheets("单表").Cells(6, 5).Value = rng.Offset(2, 3).Value
Sheets("单表").Cells(7, 5).Value = rng.Offset(2, 4).Value
Sheets("单表").Cells(8, 5).Value = rng.Offset(2, 5).Value
Sheets("单表").Cells(9, 5).Value = rng.Offset(2, 6).Value
Sheets("单表").Cells(10, 5).Value = rng.Offset(2, 7).Value
Sheets("单表").Cells(11, 5).Value = rng.Offset(2, 8).Value
Sheets("单表").Cells(12, 5).Value = rng.Offset(2, 9).Value
Sheets("单表").Cells(13, 5).Value = rng.Offset(2, 10).Value
Sheets("单表").Cells(14, 5).Value = rng.Offset(2, 11).Value
Sheets("单表").Cells(15, 5).Value = rng.Offset(2, 12).Value
Sheets("单表").Cells(16, 5).Value = rng.Offset(2, 13).Value
Sheets("单表").Cells(17, 5).Value = rng.Offset(2, 14).Value
Sheets("单表").Cells(18, 5).Value = rng.Offset(2, 15).Value
Sheets("单表").Cells(19, 5).Value = rng.Offset(2, 16).Value
End With
End If
End Sub
你的题目不太清楚,缺少更详细的资料(门牌号的排列方法很有讲究),科学一点的话,可以让查找家庭成员智能化 |
|