CINorRC = InputBox("Entrez un CIN ou RC correct.")
If StrPtr(CINorRC) = 0 Then
Exit Sub
ElseIf CINorRC = "" Then
MsgBox ("Err...")
End If
With Me.SearchDisplayX
.AddItem
.List(.ListCount - 1, 0) = "CIN/RC"
.List(.ListCount - 1, 1) = "ART"
.List(.ListCount - 1, 2) = "Nom"
.List(.ListCount - 1, 3) = "Nature"
.List(.ListCount - 1, 4) = "LI"
.List(.ListCount - 1, 5) = "**"
.List(.ListCount - 1, 6) = "DP"
.List(.ListCount - 1, 7) = "OBS"
End With
If Trim(CINorRC) <> "" Then
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Sheets
With ws.Range("A2:L999")
Set Rng = .Find(What:=CINorRC, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Rng Is Nothing Then
Application.Goto Rng, True
Me.SearchDisplayX.AddItem Rng.rows
End If
End With
Next ws
If Not Rng Is Nothing Then
MsgBox "Nothing found"
End If
End If
下面是整个代码
名为SearchDispaly的列表框仅显示CINorRC值,而不显示第一个单元格中具有该值的整个行
如果你看到其他的代码问题,我会很感激你帮助我解决它们〈3
1条答案
按热度按时间bvuwiixz1#
您可以尝试使用
Offset
方法获取整行: