我有一个包含多行的Excel电子表格。
每行有两个值start
和end
,它们可以位于每行的不同列上。
Start
始终显示在End
之前。
如何使用Excel在开始和结束之间输出列。
答案 0 :(得分:0)
这将处理第一个 10 行。根据您的需求进行调整:
Sub WhatsInBetween()
Dim i As Long, st As String, en As String
Dim M As Long, N As Long
st = "start"
en = "end"
With Application.WorksheetFunction
For i = 1 To 10
N = .Match(st, Rows(i), 0)
M = .Match(en, Rows(i), 0)
If M = N + 1 Then
MsgBox "for row " & i & " nothing between"
Else
MsgBox "for row " & i & " something between"
End If
Next i
End With
End Sub
答案 1 :(得分:0)