小编yse*_*yse的帖子

测试或检查是否存在纸张

Dim wkbkdestination As Workbook
Dim destsheet As Worksheet

For Each ThisWorkSheet In wkbkorigin.Worksheets 
    'this throws subscript out of range if there is not a sheet in the destination 
    'workbook that has the same name as the current sheet in the origin workbook.
    Set destsheet = wkbkdestination.Worksheets(ThisWorkSheet.Name) 
Next
Run Code Online (Sandbox Code Playgroud)

基本上,我遍历原始工作簿中的所有工作表,然后destsheet在目标工作簿中将其设置为与原始工作簿中当前迭代的工作表相同的工作表.

如何测试该表是否存在?就像是:

If wkbkdestination.Worksheets(ThisWorkSheet.Name) Then 
Run Code Online (Sandbox Code Playgroud)

excel scripting vba

102
推荐指数
9
解决办法
43万
查看次数

标签 统计

excel ×1

scripting ×1

vba ×1