你看看是不是要这样子
Private Sub CommandButton1_Click()
Dim intCol As Integer
Dim intFirstCol As Integer
Dim i As Integer
For intCol = 1 To 255
If Cells(1, intCol) <> "" Then
intFirstCol = intCol
Exit For
End If
Next
For i = intFirstCol To 255
If Cells(1, i) <> "" Then
MsgBox (Cells(1, i).Value)
Else
Exit For
End If
Next
End Sub
这样弹出一个消息框 提示表头那一行每一个不为空的单元格的内容