4个回答
展开全部
输入英文的比较麻烦,如果输入李的很容易
代码如下:
Option Explicit
Sub test()
Dim a As Range, b As Range
Dim tem As String, ent As String
Set a = ActiveSheet.UsedRange
ent = Application.InputBox("输入要查询的姓" & vbCrLf & vbCrLf & "比如: 李", "C0de_By_F0reSt*", "李", , , , , 2)
For Each b In a
If b.Value Like ent & "*" Then tem = tem & vbCrLf & b.Value
Next b
MsgBox "查询结果如下:" & vbCrLf & tem, , "C0de_By_F0reSt*"
Set a = Nothing
End Sub
代码如下:
Option Explicit
Sub test()
Dim a As Range, b As Range
Dim tem As String, ent As String
Set a = ActiveSheet.UsedRange
ent = Application.InputBox("输入要查询的姓" & vbCrLf & vbCrLf & "比如: 李", "C0de_By_F0reSt*", "李", , , , , 2)
For Each b In a
If b.Value Like ent & "*" Then tem = tem & vbCrLf & b.Value
Next b
MsgBox "查询结果如下:" & vbCrLf & tem, , "C0de_By_F0reSt*"
Set a = Nothing
End Sub
展开全部
这没有规定代码,你在操作过程中把它录制下来就可以,关闭EXCEL时提醒是否保存宏,你点是即可。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
自己录制个宏。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
这个不是宏的问题,我来琢磨下。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询