EXCEL在VBA程式設計中遇到日期提示的問題

時間 2022-04-09 22:50:16

1樓:太極健

按您的題意,就增加個條件即g不為空即可。修改一下可以自動計算工作表數量,就是說可以自由增減工作表

private sub workbook_open()dim i&, n&,sh&

for sh = 2 to sheets.countsheets(sh).activate

n=range("c65536").end(xlup).rowfor i = 3 to n

if cells(i,7)<>"" and int(date) - int(cells(i, 7).value) >= 30 and cells(i, 5) > 0 then

rows(i).select

msgbox "●客戶名稱:" & sheets(sh).name & chr(10) & "●合同編號:

" & cells(i, 2).value & chr(10) & "●合同金額:" & cells(i, 3).

value & "元" & chr(10) & "●發貨日期:" & cells(i, 7).value & chr(10) & "●該合同已到收款日期,請及時收款!!

"end if

next i

next sh

end sub

可您的這麼多表,達到條件的,你就提示,呵呵,記得了這麼多嗎?

你還不如達到這個條件的,就把資料統計到sheet1中這樣只要看sheet1表就知道有多少沒收回的了。

2樓:匿名使用者

if int(date) - int(.cells(i, 7).value) >= 30 and .cells(i, 5) > 0 then

改成:if cells(i,7)<>"" and int(date) - int(.cells(i, 7).

value) >= 30 and .cells(i, 5) > 0 then

3樓:匿名使用者

我在excel中用vba編了個巨集命,可在執行時提示

在excel中如何使用vba的巨集

陽光上的橋 保護公式可以這樣 選擇不需要保護 需要錄入內容 的單元格,設定單元格屬性,最後一個 保護 卡里面的 鎖定 取消,其它那些沒有取消鎖定的有公式的單元格自然是鎖定狀態。下一步是在工具 審閱 新版本 或者 工具 選單 舊版本 裡面選擇 保護工作表 設定一個密碼後確認。完成這兩步之後,鎖定的單元...

VBA請問在EXCEL中如何批量插入行

sub charuhang 你所說的假設選中哪一列,其實,插入行和選中的列不相關,有用的資訊是你所選中的行 起止行號 start inputbox 請輸入要插入行的起始行號 3 end inputbox 請輸入要插入行的終止行號 26 h inputbox 請輸入要插入行數 2 for i end ...

在excel中運用vba編寫巨集,形成10行的楊輝三角

sub 楊輝三角 dim i as integer,j as integerfor i 1 to 10 cells i,11 i 1 cells i,9 i 1 if i 3 then for j 13 i to 7 i step 2cells i,j cells i 1,j 1 cells i 1...