作者:乔山办公网日期:
返回目录:excel表格制作
用工作百表事度件,当AAA或者知BBB被激道活时内,就操作容CCC
sub ()
dim currentsheet as worksheet
set currentsheet=activesheet
if currentsheet.name="AAA" or currentsheet.name="BBB" then
worksheets("CCC").range("B2").value="xxx"
worksheets("CCC").range("B2").interior.color=65535
end if
end sub
dim fname as string
fname=thisworkbook.name
即可得到当前工作簿的名字。
获得当前工作表的名字。
fname=activesheet.name
iRows=activesheet.usedrange.rows.count
iColumns=activesheet.usedrange.Columns.count
'如果表格前面的几copy行或几列可能是空的,百需要获得最下面的行度数和最右面的列数:
with activesheet.usedrange
iEndRow=.rows.count+.row-1
iEndColumn=.Columns.count+.column-1
end with
当前是activesheet吗?
代码工作簿是thisworkbook