「Excel VBA 最初の空白でないセルを返す」の版間の差分
ナビゲーションに移動
検索に移動
(ページの作成:「==Excel VBA 最初の空白でないセルを返す== [Excel VBA][Excel] Function FindFirst(cells As Range) Dim r As Long Dim c As Long Dim ret As Ra…」) |
|||
(同じ利用者による、間の4版が非表示) | |||
1行目: | 1行目: | ||
− | ==Excel VBA 最初の空白でないセルを返す== | + | ==[[Excel VBA 最初の空白でないセルを返す]]== |
− | [Excel VBA][Excel] | + | [[Excel VBA]] | [[Excel]] | |
Function FindFirst(cells As Range) | Function FindFirst(cells As Range) | ||
Dim r As Long | Dim r As Long | ||
10行目: | 10行目: | ||
For r = 1 To cells.Rows.Count | For r = 1 To cells.Rows.Count | ||
For c = 1 To cells.Columns.Count | For c = 1 To cells.Columns.Count | ||
− | If cells(r, c).Text | + | If cells(r, c).Text <> "" Then |
Set ret = cells(r, c) | Set ret = cells(r, c) | ||
hit = True | hit = True |
2022年5月19日 (木) 14:56時点における最新版
Excel VBA 最初の空白でないセルを返す
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
© 2006 矢木浩人