トップ 一覧 ping 検索 ヘルプ RSS ログイン

Excel VBA 最初の空白でないセルを返すの変更点

  • 追加された行はこのように表示されます。
  • 削除された行はこのように表示されます。
!!!Excel VBA 最初の空白でないセルを返す
[Excel VBA][Excel]
 Function FindFirst(cells As Range)
     Dim r As Long
     Dim c As Long
     Dim ret As Range
     Dim hit As Boolean
     
     hit = False
     For r = 1 To cells.Rows.Count
         For c = 1 To cells.Columns.Count
             If cells(r, c).Text <> "" Then
                 Set ret = cells(r, c)
                 hit = True
                 Exit For
             End If
         Next
         If hit Then
             Exit For
         End If
     Next
     Set FindFirst = ret
 End Function