Private
Sub
Worksheet_SelectionChange(
ByVal
Target
As
Range)
Dim
strFilename
As
String
Dim
strValue
As
String
Dim
wbk
As
Workbook
Dim
rng
As
Range
Set
rng = refersToRange(
"Buttons"
)
If
Not
Intersect(rng, Target)
Is
Nothing
Then
strFilename = ThisWorkbook.Path &
"\autoFile_2.xlsm"
Set
wbk = GetWorkbook(strFilename)
If
wbk
Is
Nothing
Then
Set
wbk = Application.Workbooks.Open(filename:=strFilename)
Else
wbk.Activate
End
If
strValue = Target.Cells(1, 1).Value
If
Not
strValue =
""
Then
wbk.Worksheets(1).Range(
"B18"
).Value = strValue
End
If
strValue = Target.Cells(1, 1).Offset(columnOffset:=4).Value
If
Not
strValue =
""
Then
wbk.Worksheets(1).Range(
"B11"
).Value = strValue
End
If
strValue = Target.Cells(1, 1).Offset(columnOffset:=5).Value
If
Not
strValue =
""
Then
wbk.Worksheets(1).Range(
"B12"
).Value = strValue
End
If
strValue = Target.Cells(1, 1).Offset(columnOffset:=6).Value
If
Not
strValue =
""
Then
wbk.Worksheets(1).Range(
"G10"
).Value = strValue
End
If
strValue = Target.Cells(1, 1).Offset(columnOffset:=7).Value
If
Not
strValue =
""
Then
wbk.Worksheets(1).Range(
"B9"
).Value = strValue
End
If
End
If
End
Sub