2009年12月18日金曜日

Excelマクロ シートの値取得、検索

シートの値を取得する方法
Worksheets("シート名").Cells(列, 行).Value



検索ロジック
Set objFind = Worksheets("シート名").Cells.Find(What:=検索する値, LookAt:=xlWhole, After:=Cells(1, 2), SearchOrder:=xlByRows)

If Not objFind Is Nothing Then
strAddress = objFind.Address

Do While Not objFind Is Nothing
lngYLine = objFind.Cells.Row
intXLine = objFind.Cells.Column
  MsgBox ""

IF 見つかった場合の処理


'次のデータを検索
Set objFind = Worksheets("出力").Cells.FindNext(objFind)

'最後のデータの場合
If strAddress = objFind.Address Then
Exit Do
End If
Loop

End If

0 件のコメント:

コメントを投稿