如果文本是使用Alt+Enter方法在单元格中输入的,则可以在VBA中使用以下代码:
" & Chr(10) & "
下面为样例的.Find方法。
Private Sub CommandButton1_Click()
Set RngClosedDate = Range("A1:Z10").Find(What:="Closed" & Chr(10) & "(Date)", LookAt:=xlWhole, LookIn:=xlValues)
' If the text that is searched for from the line above is not found then a message box is displayed and sub function is exitied
If RngClosedDate Is Nothing Then
MsgBox "Closed (Date) Column Header Not found. Cannot sort or format records."
Exit Sub
End If
End Sub
标签:vba,End,Sub,单元格,Chr,Closed,find
From: https://www.cnblogs.com/xs1987/p/17851867.html