原創: 牛超
2009-05
osaka
自動生成批處理名,規則為jobid前三位+流水號
如題,放置按鈕,遍歷行,統計jobid數,設定結果值
**如下:
private type job
jobid as string
cnt as integer
end type
dim job(100) as job
private sub commandbutton1_click()
dim strget as string
dim strret as string
dim itmp as integer
dim i as integer
dim flag as boolean
for mindex = 1 to activesheet.cells.rows.count
strget = activesheet.cells(mindex, 4)
if not left(strget, 1) = "r" then
goto con
end if
strget = left(strget, 3)
flag = false
for i = 0 to 100
if len(job(i).jobid) = 0 then
exit for
end if
if strget = job(i).jobid then
flag = true
exit for
end if
next
if not flag then
job(i).jobid = strget
job(i).cnt = 0
end if
if strget = job(i).jobid then
itmp = job(i).cnt
itmp = itmp + 1
job(i).cnt = itmp
strret = rtrim(ltrim(str(itmp)))
strret = "00" + strret
strret = right(strret, 2)
strret = strget + strret + ".bat"
activesheet.cells(mindex, 6) = strret
end if
con:
next
end sub
獲得EXCEL的SHEET名
需要引用com元件microsoft excel 11.0 object library using system using system.collections using system.componentmodel using system.data using system.data.sql...
Delphi生成多Sheet的Excel檔案
delphi生成多sheet的excel檔案的 uses comobj range.columns 1 columnwidth 6 序號 range.columns 2 columnwidth 20 檔號 range.columns 3 columnwidth 60 題名 range.columns...
將Excel裡面的sheet合併
首先新建乙個sheet,按快捷鍵alt f11,再將下面 複製進去 sub 合併當前工作簿下的所有工作表 for j 1 to sheets.count if sheets j name activesheet.name then x range a65536 end xlup row 1 shee...