|
ゴメン、再投稿
Option Explicit
Sub Test()
Dim i As Long
Dim vntSheet As Variant
Dim wksMark As Worksheet
vntSheet = Array("A", "B", "C")
For i = 0 To 2
If SheetExist(vntSheet(i), wksMark) Then
With wksMark
.Select
.Range("E1").Select
Sheets("X").Range("F8").Offset(i).Value _
= wksMark.Range("B11").Value
End With
End If
Next i
Sheets("X").Activate
Set wksMark = Nothing
End Sub
Private Function SheetExist(vntName As Variant, _
wksMark As Worksheet) As Boolean
Dim blnExit As Boolean
For Each wksMark In Worksheets
If StrComp(wksMark.Name, vntName) = 0 Then
blnExit = True
Exit For
End If
Next wksMark
SheetExist = blnExit
End Function
|
|