'実行ファイルと同じ場所に空のAccessファイルを作成
Dim zzDBAdox As Object
Set zzDBAdox = CreateObject("ADOX.Catalog")
zzDBAdox.Create "Provider=Microsoft.Ace.OLEDB.12.0;Data Source=" & ThisWorkbook.Path & "\作成DB.accdb"
Set zzDBAdox = Nothing
Function zzz辞書作成(ByVal hzzセル範囲 As Range, Optional ByVal hzzオフセット列数 As Long = 0) As Object
Dim zz辞書 As Object: Set zz辞書 = CreateObject("Scripting.Dictionary")
Dim zz対象セル As Range
For Each zz対象セル In hzzセル範囲
If zz対象セル <> "" Then
If zz辞書.Exists(zz対象セル.Text) = False Then
zz辞書.Add zz対象セル.Text, zz対象セル.Offset(0, hzzオフセット列数).Text
Else: End If
Else: End If
Next zz対象セル
If zz辞書.Count <> 0 Then
Set zzz辞書作成 = zz辞書
Else: End If
Set zz辞書 = Nothing
End Function
Dim zz辞書 As Object
Set zz辞書 = zzz辞書作成(Range("A2:A10"), 1)
If zz辞書 Is Nothing Then
Exit Sub
Else: End If
Dim zz取得キー As Variant
For Each zz取得キー In zz辞書.Keys
Debug.Print zz辞書(zz取得キー)
Next zz取得キー
Function zzzワークシート取得(ByVal hzz検索文字列, Optional ByVal hzzCN検索 As Boolean = False) As Worksheet
Dim zz対象Bk As Workbook, zz対象Sh As Worksheet, zz取得Sh As Worksheet
For Each zz対象Bk In Application.Workbooks
For Each zz対象Sh In zz対象Bk.Worksheets
If hzzCN検索 = True Then
If zz対象Sh.CodeName Like hzz検索文字列 Then
Set zz取得Sh = zz対象Sh: Exit For
Else: End If
Else
If zz対象Sh.Name Like hzz検索文字列 Then
Set zz取得Sh = zz対象Sh: Exit For
Else: End If
End If
If Not zz取得Sh Is Nothing Then
Exit For
Else: End If
Next zz対象Sh
Next zz対象Bk
Set zz対象Sh = Nothing
Set zz対象Bk = Nothing
If Not zz取得Sh Is Nothing Then
Set zzzワークシート取得 = zz取得Sh
Set zz取得Sh = Nothing
Else: End If
End Function
Dim zz対象Sh As Worksheet
Set zz対象Sh = zzzワークシート取得("Sheet1")
If zz対象Sh Is Nothing Then
Exit Sub
Else: End If
zz対象Sh.Range("A1") = 1000
zz対象Sh.Parent.Save
If hzzCN検索 = True Then
If zz対象Sh.CodeName Like hzz検索文字列 Then
Set zz取得Sh = zz対象Sh: Exit For
Else: End If
Else
If zz対象Sh.Name Like hzz検索文字列 Then
Set zz取得Sh = zz対象Sh: Exit For
Else: End If
End If