|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub 按钮1_Click()
If Len([b1]) <> 4 Then
MsgBox "b1单元格数据不符合要求"
Exit Sub
End If
ActiveSheet.UsedRange.Offset(2).ClearContents
arr = Sheets("原始数据").UsedRange
r = 0
For j = 2 To UBound(arr)
If Right(arr(j, 5), 4) = [b1] & "" Then
r = r + 1
For i = 1 To UBound(arr, 2)
arr(r, i) = arr(j, i)
Next i
End If
Next j
If r > 0 Then [a3].Resize(r, 5) = arr
End Sub
Sub 按钮2_Click()
Application.ScreenUpdating = False
For j = 3 To Cells(Rows.Count, 5).End(3).Row
Set Rng = Sheets("原始数据").Columns(5).Find(Cells(j, 5), lookat:=xlWhole)
If Not Rng Is Nothing Then Rng.Offset(0, 1) = "已入住"
Next j
Application.ScreenUpdating = True
End Sub
|
|