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

[µo°Ý] ÅçÃÒÄæ¦ì¦WºÙ°ÝÃD¡C

[µo°Ý] ÅçÃÒÄæ¦ì¦WºÙ°ÝÃD¡C

ÅçÃÒÄæ¦ì¦WºÙ°ÝÃD¡C

°²³]A1:E1 ¦³ 5­ÓÄæ¦ì¦WºÙ

¨C¤@­ÓÄæ¦ì¦WºÙ§Ú­nÅçÃÒ¬O§_¬O§Ú©Ò­n¨Dªº¦WºÙ¡C

¨Ò¦p A1¦ÜE1 ¤À§O¬O


Line   JobNo  Color  Size  PO  


§Ú­n¥ý¶}©lÅçÃÒA1¬O¤£¬OLine, B1¬O¤£¬OJob No, C1¬O¤£¬OColor,D1¬O¤£¬OSize, E1¬O¤£¬OPO

¦pªG¥ÑA1Àˬd¨ìE1 ¦pªG¬O§Ú©ÒÅçÃÒªºÄæ¦ì¦WºÙ(»Ý­n¤j¤p¼g§¹¥þ¬Û²Å),¦pªG¬Oªº¸Ü,¦bÀˬd«á¥H¤@­Ó¼u¥X¦¡´£¥Ü
§iª¾ ¨S¦³°ÝÃD¡C ¥H¤@¦¸´£¥Ü, ¤£¯à¨C¤@­ÓÅç¨ì¦³°ÝÃD«á¦A¤@ª½¼u¥X´£¥Ü¡C

¦pªGA1¦ÜE1 ¦³¥ô¦ó¤@­ÓÄæ¦ì¦WºÙ»P§Ú©Ò­n¨Dªº¤£²Å,«h¼u¥X¦¡´£¥Ü ¦³°ÝÃD,¦nÅý§Ú¤§«á¬dÃÒ¡C ÁÂÁÂ

  1. Sub zz()
  2. Dim c, a, Msg$, n&
  3. c = Array("Line", "JobNo", "Color", "Size", "PO")
  4. a = [a1:e1].Value
  5. For j = 1 To UBound(a, 2)

  6. If UCase(c(j - 1)) = UCase(a(1, j)) Then
  7.     Msg = Msg & Chr(10) & j & " " & "Text compare passed"
  8.     If Not c(j - 1) = a(1, j) Then
  9.         Msg = Msg & " but Case not matched"
  10.     Else
  11.         Msg = Msg & " and Case macthed"
  12.         n = n + 1
  13.     End If
  14. Else
  15.     Msg = Msg & Chr(10) & j & " " & "String compare failed"
  16. End If
  17. Next
  18. If n = UBound(a, 2) Then Msg = "!All Passed"
  19. If Len(Msg) > 0 Then Debug.Print Mid(Msg, 2)
  20. End Sub
½Æ»s¥N½X

TOP

ikboy µoªí©ó 2020-9-14 10:49



  ÁÂÁ¤j­ôÀ°¦£,¤£¦n·N«ä§Ú¶K¤W¤F¤§«á ,¨S¦³¥ô¦ó´£¥Ü¼u¥X,¥i§_¦A³Â·Ð§AÀ°¦£¦A¬Ý¤@¤U ¥N½X¬O§_¦³°ÝÃD¡C

«D±`·PÁ»դUÀ°¦£¡C

TOP

¥»©«³Ì«á¥Ñ ­ã´£³¡ªL ©ó 2020-9-14 12:02 ½s¿è

¤j¤p¼g¥²¶·¬Û¦P:
Sub Macro1()
Dim AR, i%, M, C%
M = Array("ÀˬdµL»~", "¦³¿ù»~-¼Ð¥Ü¬õ¦r")
AR = Array("", "Line", "JobNo", "Color", "Size", "PO")
With Range("A1:E1")
     .Font.ColorIndex = 0
     For i = 1 To .Count
         If .Item(i) <> AR(i) Then .Item(i).Font.Color = vbRed: C = 1
     Next i
End With
MsgBox M(C)
End Sub

Àˬd¤@­Ó¤£²Å§Y¸õ¥X:
If .Item(i) <> AR(i) Then .Item(i).Font.Color = vbRed: C = 1: Exit For

­Y¦³ªÅ®æ°ÝÃD, ±N¤å¦r¦â§ï¦¨©³¦â .Interior.Color


========================

TOP

ÁÂÁ¤j­ôÀ°¦£,¤£¦n·N«ä§Ú¶K¤W¤F¤§«á ,¨S¦³¥ô¦ó´£¥Ü¼u¥X,¥i§_¦A³Â·Ð§AÀ°¦£¦A¬Ý¤@¤U ¥N½X¬O§_¦³°ÝÃD¡C ...
stephenlee µoªí©ó 2020-9-14 11:15



    §Ú¨Ï¥ÎDebug.print Åã¥Ü, §A¥i¥H§ï¬° Msgbox Mid(Msg, 2)

TOP

        ÀR«ä¦Û¦b : ¬Ý§O¤H¤£¶¶²´¡A¬O¦Û¤v­×¾i¤£°÷¡C
ªð¦^¦Cªí ¤W¤@¥DÃD