我有以下代码根据用户输入来搜索数据。 我想隐藏那些不匹配的行,以便用户可以更好地查看。 我的数据从第7行开始。谢谢。
CREATE TRIGGER balanceCheck
BEFORE INSERT
ON reservations
FOR EACH ROW
BEGIN
IF NOT NEW.balance <=> NEW.charge THEN
SET NEW.balance = NEW.charge;
END IF;
END;
答案 0 :(得分:1)
在代码中尝试类似的操作(在输入框中添加其他代码以捕获FindString
)
Dim StringValueColumn as long
StringValueColumn = wrkSht.Cells.Find(What:=FindString, After:=wrkSht.Range("A1"), LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False).Column
MyRange.AutoFilter StringValueColumn, "=[ValueToKeepVisible]"
更新
像这样简单的事情将起作用。
Option Explicit
Public Sub FilterRows()
Dim MyRange As Range
Dim FindString As String
Dim FindRange As Range
Set MyRange = ActiveSheet.Range("A1").CurrentRegion
FindString = InputBox("Type a Value")
Set FindRange = MyRange.Find(What:=FindString)
If Not FindRange Is Nothing Then
MyRange.AutoFilter FindRange.Column, FindString
End If
End Sub
样本数据
Range("A1:C4")
First Middle Last 'Header Values
Brian Daniel Smith
Larry Amos Smith
Tanya Esther Schmidt