我正在尝试复制工作簿中的现有工作表,然后我想使用复制的工作表来运行我的其余代码。 (Sheet3是现有工作表,S_Temp是复制工作表)
Dim s_Temp as string
Sheet3.copy
Activesheet.name = S_Temp
Sheets("S_Temp").Range("A1").value = "Test"
如何参考复印的纸张?
答案 0 :(得分:2)
以下是我刚刚找到的解决方案:
Dim s_Temp as Worksheet
Sheet3.copy
set S_Temp = Activesheet
S_Temp.Range("A1").value = "Test"
答案 1 :(得分:1)
Sheet3.copy
'From this point onwards, the active sheet has changed
Activesheet.name = S_Temp
'Hence, this will be A1 on the copied sheet.
Range("A1").value = "Test"
我误解了这个问题吗?