="期中","八年级期中考试成绩","八年级期期末考试成绩")这里面的双引号都要转义,否则语句认为到"...b2=",就已经结束了。
Range("A1").Formula = "=if(sheet1!b2=""期中"",""八年级期中考试成绩"",""八年级期期末考试成绩"")"
这样试一试Range("A1").Formula = "=if(sheet1!b2="""期中""","""八年级期中考试成绩""","""八年级期期末考试成绩""")"