返回列表 上一主題 發帖

[發問] 如何能找到最後一列有資料的列數?(忽略空格)

回復 1# 小俠客

Set c = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious)
Do While Not c Is Nothing
    If Trim(c.Value) = "" Then
        c.ClearContents  '看你要不要清除掉該空白字元
        Set c = Cells.FindPrevious(c)
    Else
        lastRow = c.Row
        Exit Do
    End If
Loop

TOP

        靜思自在 : 看別人不順眼,是自己修養不夠。
返回列表 上一主題