2016-10-03 14 views
0

次の数式を範囲A2:A100に入力するスクリプトがあります。VBAコードを改善する

WBNAME3 = "=IF(AND('\\insurance\it\FileData\Computers\DIPS\Change Control\[Justice League.xlsm]iForms'!A2<>"""", '\\insurance\it\FileData\Computers\DIPS\Change Control\[Justice League.xlsm]iForms'!E2=""""),'\\insurance\it\FileData\Computers\DIPS\Change Control\[Justice League.xlsm]iForms'!A2,"""")" 
Worksheets("All Release Items").Range("E2:E100").Value = WBNAME3 

スクリプトを短くするために、以下の変数を定義しようとしています。

Justice = "=IF(AND('\\insurance\it\FileData\Computers\DIPS\Change Control\[Justice League.xlsm]" 

私が間違っている場所を教えてもらえますか?

ありがとうございます。

答えて

1

私はこれがあなたが達成しようとしているものだと思います。そうでない場合は、私に知らせてください。

Justice = "'\\insurance\it\FileData\Computers\DIPS\Change Control\[Justice League.xlsm]iForms'" 

WBNAME3 = "=IF(AND(" & Justice & "!A2<>"""", " & Justice & "!E2=""""),!" & Justice & "!A2,"""")" 
Worksheets("All Release Items").Range("E2:E100").Formula= WBNAME3