标题:VBA数据调取数据重复,不知所措
取消只看楼主
ds378079379
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2021-9-13
结帖率:0
已结贴  问题点数:20 回复次数:0 
VBA数据调取数据重复,不知所措
在表1和表2数据调取过程中,新录入数据会重复,求救。

程序代码:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim a As Integer
Dim b As Integer
b = 2
Do
b = b + 1
If Sheet2.Cells(b, 1) = "" Then
Exit Do
End If
Loop
For a = 4 To 3000
   If Sheet1.Cells(a, 13) = "已术" Then
       Sheet2.Cells(b, 1) = Sheet1.Cells(a, 2)
       Sheet2.Cells(b, 2) = Sheet1.Cells(a, 3)
       Sheet2.Cells(b, 3) = Sheet1.Cells(a, 4)
       Sheet2.Cells(b, 4) = Sheet1.Cells(a, 5)
       Sheet2.Cells(b, 5) = Sheet1.Cells(a, 6)
       Sheet2.Cells(b, 6) = Sheet1.Cells(a, 7)
       Sheet2.Cells(b, 7) = Sheet1.Cells(a, 8)
       Sheet2.Cells(b, 8) = Sheet1.Cells(a, 16)
       Sheet2.Cells(b, 9) = Sheet1.Cells(a, 17)
       b = b + 1
      End If
      Next
End Sub

屈光专科护士登记表测试一版.rar (58.16 KB)
搜索更多相关主题的帖子: VBA End 数据 If 重复 
2021-09-13 14:10



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-506830-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.025634 second(s), 9 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved