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

[µo°Ý] ¦p¦óÅýA¡BB¤GÄæ¦r¦ê¤ñ¹ï¦¨¥\©O¡H

[µo°Ý] ¦p¦óÅýA¡BB¤GÄæ¦r¦ê¤ñ¹ï¦¨¥\©O¡H

¦U¦ì¤j¤j¦n¡G
test.rar (6.68 KB)
¤p§Ì¦³A¡BB¤GÄ檺¤å¦r¦r¦ê¡A
¤]¥ý§Q¥Î TRIM¨Ó¨ú¥X¦r¦ê¤ñ¹ï¡A
¦ýÁÙ¬OµLªk¦¨¥\¤ñ¹ï¡C¤£ª¾À³¦p¦ó
¥i逹¦¨¤ñ¹ï¤å¦r©O¡H
»yªk¦p¤U¡G
Sub aa()   
    Dim mSht1 As Worksheet
    Dim mRng As Range, mRng1 As Range
    Dim mStr1$, mStr2$
   
    Set mSht1 = Worksheets(1)
    With mSht1
        Set mRng1 = .Range("a2", .Range("a" & .Rows.Count).End(xlUp))
        For Each mRng In mRng1
            mStr1 = Trim(mRng.Value)
            mStr2 = Trim(mRng.Offset(, 1))
            mRng.Offset(, 2) = IIf(StrComp(mStr1, mStr2, vbTextCompare) = 0, "TRUE", "FALSE")
        Next
    End With
End Sub


ÁÂÁ¦U¦ì¤j¤j¡I

¦^´_ 1# dechiuan999


¦]¬°VBA¸Ì­±ªºTRIM¡A¦ü¥G¥u·|¥h®ø°£ÀY§ÀªºªÅ¥Õ®æ¡A¤å¦r¤¤¶¡ªºªÅ¥Õ®æ¤£²z·|¡C
¦ÓEXCEL¨ç¼Æ¸ÌªºTRIM«h¥i¥H³B²z³o­Ó°ÝÃD¡C
©Ò¥H§A¥u­n¦b¤G­ÓTRIMªº«e­±¥[­Ó¡yAPPLICATION.¡z¡A°ÝÃD´N¸Ñ¨M¤F¡C
  1. Sub aa()
  2.     Dim mSht1 As Worksheet
  3.     Dim mRng As Range, mRng1 As Range
  4.     Dim mStr1$, mStr2$
  5.    
  6.     Set mSht1 = Worksheets(1)
  7.     With mSht1
  8.         Set mRng1 = .Range("a2", .Range("a" & .Rows.Count).End(xlUp))
  9.         For Each mRng In mRng1
  10.             mStr1 = Application.Trim(mRng.Value)
  11.             mStr2 = Application.Trim(mRng.Offset(, 1))
  12.             mRng.Offset(, 2) = IIf(StrComp(mStr1, mStr2, vbTextCompare) = 0, "TRUE", "FALSE")
  13.         Next
  14.     End With
  15. End Sub
½Æ»s¥N½X

TOP

¦^´_ 2# owen06


    ÁÂÁ¤j¤j¦p¦¹¸Ô²Ó»¡©ú¡C
TRIMªº¥Îªk¡AÁÙ¦³¤GºØ¤è¦¡¡C
¤p§Ì­ì¥H¬°¤@¯ëAPPLICATION
¦bVBA¬O¥i¬Ù²¤¡C
¤µ¤Ñ¤~¤F¸Ñ¨ì¦³¦p¦¹®t²§¡C

·P®¦¤j¤j¡I

TOP

        ÀR«ä¦Û¦b : ¡i®É¶¡¦¨´N¤@¤Á¡j®É¶¡¥i¥H³y´N¤H®æ¡A¥i¥H¦¨´N¨Æ·~¡A¤]¥i¥HÀx¿n¥\¼w¡C
ªð¦^¦Cªí ¤W¤@¥DÃD