excel VBA 簡單操作

2021-05-01 21:12:10 字數 399 閱讀 1593

public sub ss()

dim sht as worksheet

set sht = thisworkbook.worksheets("sheet1")

sht.cells(1, 1) = now()

end sub

public sub getrow()

dim rnum as integer

dim sht as worksheet

rnum = activesheet.usedrange.rows.count

set sht = thisworkbook.worksheets("sheet1")

rnum = rnum + 1

sht.cells(rnum, 1) = now()

end sub

Excel VBA檔案操作1

在我們日常使用excel的時候,不僅會用到當前excel檔案的資料,還經常需要訪問其他的資料檔案。這些資料檔案可能是excel檔案 文字檔案或資料庫檔案等。經常有朋友會問如何在vba 裡操作這些資料檔案?本文就系統地介紹一下在excel中應用vba運算元據檔案的方法。1 利用excel物件來處理檔案...

Excel VBA檔案操作2

workbooks.opentext filename,origin,startrow,datatype,textqualifier,consecutivedelimiter,tab,semicolon,comma,space,other,otherchar,fieldinfo,textvisual...

Excel VBA檔案操作3

stylesheets variant 型別,可選。單個值或值的陣列,用於指定要應用哪些 xsl 轉換 xslt 樣式表處理指令。loadoption variant 型別,轉換。指定 excel 開啟 xml 資料檔案的方式。可為 xlxmlloadoption 常量之一。xlxmlloadopt...