菜鸟求vba代码关于表查询和删除的
发布网友
发布时间:2024-09-24 06:33
我来回答
共1个回答
热心网友
时间:2024-09-28 10:44
查找按钮:
Dim MS1 As Worksheet
Dim MS2 As Worksheet
Set MS1 = Workbooks("表一.xls").Sheets("xxx")
Set MS2 = Workbooks("表二.xls").Sheets("xxx")
Dim s As String
Dim x As Integer
s=InputBox("输入你要查找的名字")
x = MS2.Columns("A").Find(What:=s, LookAt:=xlWhole).Row
MS2.Rows(x).Copy Destination:=MS1.Cells(2, 1)
修改按钮:
Dim MS1 As Worksheet
Dim MS2 As Worksheet
Set MS1 = Workbooks("表一.xls").Sheets("xxx")
Set MS2 = Workbooks("表二.xls").Sheets("xxx")
Dim s As String
Dim x As Integer
s=MS.Cells(2,1)
x = MS2.Columns("A").Find(What:=s, LookAt:=xlWhole).Row
MS1.Rows(2).Copy Destination:=MS2.Cells(x, 1)