ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] Excel VBA ±ø¥ó¦¨¥ß«á¡A¦sÀɮɴ£¿ô

[µo°Ý] Excel VBA ±ø¥ó¦¨¥ß«á¡A¦sÀɮɴ£¿ô

Dear ¦U¦ì¥ý¶i,
Excel VBA ¬O§_¥i¥H¨Ì¾Ú"¤µ¤Ñ¤é´Á"¥B¦³"±b­±¿ù»~"¡A¤@¥¹¦¨¥ß«á¡A¦sÀɮɷ|´£¿ô©O¡H
¦A³Â·Ð¤j®a¡A·P®¦¡I¡I


001.jpg
2020-11-9 19:03



¦sÀɮɷ|´£¥Xĵ§iµe­±.rar (8.92 KB)
Just do it.

  1. Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
  2. Dim d As Date, a, b, r&, c&, t As Boolean
  3. r = [c1].CurrentRegion.Rows.Count - 1
  4. c = Columns("aj").Column
  5. a = Cells(2, 1).Resize(r, c).Value
  6. b = Cells(2, "aq").Resize(r).Value
  7. For i = 1 To UBound(a)
  8.     d = a(i, 3)
  9.     If a(i, c - 1) > a(i, c) Then b(i, 1) = "±b­±¿ù»~": If d = Date Then t = True
  10. Next
  11. Cells(2, "aq").Resize(r) = b
  12. If t Then MsgBox "½Ðª`·N" & Date & "±b­±¿ù»~"
  13. End Sub
½Æ»s¥N½X

TOP

¦^´_ 2# ikboy

Dear ikboy,
±z¦n¡I´ú¸Õ¥i¥H¨Ï¥Î¡A«D±`·PÁ±zªº¼ö¤ßÀ°¦£¡C
  
¦A±z½Ð±Ð
­Y¦bCÄæ¦ì(¤é´ÁÄæ¦ì)¡A¥L¿é¤Jªº¤é´Á«D¤µ¤é¤é´Á¡A¦³¥i¯à¿é¤Jªº¤é´Á¬°¬Q¤é©Î¬O¤j«e¤Ñ¡C
¬O§_¥iÅýVBA§PŪ¡A¥HCÄæ¦ì³Ì«áÄæ¦ì¥X²{ªº¤é´Á(¦³¥i¯à¿é¤Jªº¤é´Á¬°¬Q¤é©Î¬O¤j«e¤Ñ)¥h§PŪ¡Ahighlight "±b­±²§±`"

¦p¤µ¤é¬° 2020/11/10 ¡A¦bCÄæ¦ì¤W³Ì·s¿é¤Jªº¤é´Á¬° 2020/11/9 ©Î¬O 2020/11/8
Just do it.

TOP

¤£©ú¥Õ! ½Ð¦C¥X°ÝÃD,¼ÒÀÀ­n¨Dµ²ªG¡C

TOP

¦^´_ 4# ikboy


Dear ikboy,

¦p¤U¹Ï¡A¦A³Â·Ð±z¤F

V2.jpg
2020-11-10 11:58



Excel_VBA-±b­±¿ù»~-¦sÀɮɷ|´£¥Xĵ§iµe­± V2.rar (14.53 KB)
Just do it.

TOP

  1. Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
  2. Dim d As Date, a, b, r&, c&, t As Boolean
  3. r = [c1].CurrentRegion.Rows.Count - 1
  4. c = Columns("aj").Column
  5. a = Cells(2, 1).Resize(r, c).Value
  6. b = Cells(2, "aq").Resize(r).Value
  7. d = Application.Max(Cells(2, 3).Resize(r))
  8. For i = 1 To UBound(a)
  9.     If a(i, c - 1) > a(i, c) Then b(i, 1) = "±b­±¿ù»~": If d = a(i, 3) Then t = True
  10. Next
  11. Cells(2, "aq").Resize(r) = b
  12. If t Then MsgBox "½Ðª`·N" & d & "±b­±¿ù»~"
  13. End Sub
½Æ»s¥N½X

TOP

¦^´_ 5# jsc0518


Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim R, D, i&, K%
R = Cells(Rows.Count, "C").End(xlUp).Row
D = Cells(R, "c")
If Not IsDate(D) Then Exit Sub
For i = R To 2 Step -1
    If Cells(i, "c") <> D Then Exit For
    If Cells(i, "AQ") = "±b­±¿ù»~" Then K = 1: Exit For
Next i
If K > 0 Then MsgBox "½Ðª`·N!! " & D & " ±b­±¿ù»~ "
End Sub

TOP

¦^´_ 7# ­ã´£³¡ªL
Dear ­ã´£³¡ªL,
·PÁ±zªº¤èªk¡ATEST OK¡C
Thank you.
Just do it.

TOP

¦^´_ 6# ikboy

Dear ikboy,
·PÁ±z¼ö¤ß«ü¾É¼Ú¡I
Thank you so much.
Just do it.

TOP

¦^´_ 7# ­ã´£³¡ªL

ª©¥D±z¦n
¤£¦n·N«ä¡A¥i§_³Â·Ð±z»¡©ú»yªkªº·N«ä
·PÁ±z

TOP

        ÀR«ä¦Û¦b : ­n¥Î¤ß¡A¤£­n¾Þ¤ß¡B·Ð¤ß¡C
ªð¦^¦Cªí ¤W¤@¥DÃD