0
我想要使用宏来添加表后特定工作表。假设这张表名为102014.我希望这个宏在名为112014的102014之后创建一张表,但是我不能使用select或active表,因为它实际上是一个大宏的一部分,我来回切换在工作簿之间。这里是我试图做的,没有成功:'工作簿.sheets.add后'不工作
dim wbname as string
dim thismonth as string
dim lastmonth as string
thismonth = ThisWorkbook.Worksheets("Sheet2").Cells([address of a cell with the name of the sheet).Value
lastmonth = ThisWorkbook.Worksheets("Sheet2").Cells([address of a cell with the name of the sheet).Value
wbname = ThisWorkbook.Sheets("Sheet2").Cells([address of a cell with the file name here])
Workbooks(wbname).Sheets.Add(After = wbkname.Sheets(lastmonth)).Name = thismonth
宏只是将最后一行,并进入到另外一个,没有错误,什么都没有。正如你所看到的,我有一个带有表名和文件名的列表,这是我从中获得thismonth
,lastmonth
和wbname
变量的地方。
我在做什么错?
look [here](http://stackoverflow.com/questions/20697706/how-to-add-a-named-sheet-at-the-end-of-all-excel-sheets) –
你需要一个“后”冒号后 – 9Deuce