|
▼ばら さん:
Sub H()
'対象シート名の配列
ArySht = Array("SHEET1", "SHEET2", "SHEET3")
'対象セルの配列
AryRng = Array("A1", "A2", "A3", "A4", "A5")
BNM = Application.GetOpenFilename(".XLS,*.XLS", , "集計ファイル選択", , True)
If TypeName(BNM) <> "Boolean" Then
For Each BUF In BNM
XT = Split(BUF, "\")
STR1 = "='" & Left(BUF, Len(BUF) - Len(XT(UBound(XT)))) & "[" & XT(UBound(XT)) & "]"
For Each SHT In ArySht
For Each RNG In AryRng
STT = STR1 & SHT & "'!" & RNG
WITH Sheets(SHT).Range(RNG)
I = .Value
.Value = STT
.Value = .Value + I
End With
Next
Next
Next
End If
End Sub
|
|