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

[µo°Ý] °}¦C¤Î¥t¤@­Ó¤p°ÝÃD(¤w¸Ñ¨M)

[µo°Ý] °}¦C¤Î¥t¤@­Ó¤p°ÝÃD(¤w¸Ñ¨M)

¥»©«³Ì«á¥Ñ icestormer ©ó 2012-5-3 09:33 ½s¿è

­ì¥»·Qªk¬O ·í­n³]©w®æ¦¡®É¥ý©I¥s ¸ê®Æ®æ¦¡§PÂ_ °Æµ{¦¡ §Ë¦¨°}¦C«á ¦^¶Ç

µM«á®Ú¾Ú°}¦C¤ºªº(¥Ñ0 -3)¤£¦P¼Æ¦r¨Ó¹ï¸ê®Æ¾ãÄæ¶i¦æ¤£¦Pªº®æ¦¡¤Æ
-------------------------------------------------------------------------------
§Ú¬O·Q»¡ ¥i¤£¥i¥H§â ¸ê®Æ®æ¦¡§PÂ_ ³o­Ó°Æµ{¦¡ ¥Ñ private sub workbook_open()  ¦b¥´¶}EXCEL®É´N¥ý°µ¦n

µM«á ·í  §PÂ_¸ê®Æ®æ¦¡_1()»Ý­n¥Îmydata()¤ºªº¸ê®Æ®É´N®³¨Ó¨Ï¥Î

¦Ó¤£¥Î­n¶]¤@¦¸®É´N¥h°õ¦æ¤@¦¸¸ê®Æ®æ¦¡§PÂ_?

¤£ª¾¹D¯à¤£¯à·Ó§Ú»¡ªº³o¼Ë§ï©OÁÙ¬O¤@©w­n­n¥Î®É´N±o¥h°õ¦æ¤@¦¸¨ú±o°}¦Cªº­È¨Ã¦^¶Ç  ÁÂÁÂÀ°¦£

¥t¥~°Ý¤p¤p°ÝÃD. §Ú·Q§Q¥Î¥H¤Uµ{¦¡½XÃö±¼EXCEL(¾ã­ÓÃö±¼)
¤£ºÞ§Ú¬O±Ä¥ÎThisWorkbook.Close ©Î¬OApplication.Quit©Î¬O ActiveWindow.Close ÁÙ¬O¤T­Ó¤@°_¥Î..³£¨Sªk¾ã­ÓÃö³¬EXCEL

Application.DisplayAlerts = False
                  ThisWorkbook.Close
                   Application.Quit
                   ActiveWindow.Close
Application.DisplayAlerts = true


³o¬O¹Ï¤ù³sµ²,¤W­z«ü¥O¥u·|ÃöÃöactiveworkbook¦Ó¤w,³o¬O¬°¤°»ò©O?§Ú¬O·Q­n§â¥¦§¹§¹¾ã¾ãªºÃö³¬ ´N¦n¹³§A¨S¦³¥´¶}EXCEL¤@¼Ë

                              ®æ¦¡³]©w.rar (8.95 KB)

¦^´_ 1# icestormer

1.²¤Æ¤@¤U
  1. Sub ³]©w®æ¦¡()
  2. Dim mydata()
  3. ³Ì«á¸ê®Æ¦æ = [A5].End(xlDown).Row
  4. ¸ê®Æªø«× = [A5].End(xlToRight).Column
  5. ReDim mydata(¸ê®Æªø«×)
  6. For i = 1 To ¸ê®Æªø«×
  7.   Set Rng = Range("A6:A" & ³Ì«á¸ê®Æ¦æ).Offset(0, i - 1)
  8.   Select Case Left(Cells(5, i), 1)
  9.   Case "%"
  10.      mydata(i) = 2
  11.      Rng.NumberFormatLocal = "0.00%"
  12.   Case "$"
  13.      mydata(i) = 1
  14.      Rng.NumberFormatLocal = "$#,##0.00"
  15.   Case "§A"
  16.      mydata(i) = 3
  17.      Rng.NumberFormatLocal = "G/³q¥Î®æ¦¡"
  18.   Case Else
  19.      mydata(i) = 0
  20.      Rng.NumberFormatLocal = "#,##0.00_ "
  21.   End Select
  22. Next
  23. End Sub
½Æ»s¥N½X
2.Application.Quit

TOP

¦^´_ 2# register313
½Ð±Ð¤@¤U¡A±z¦bµ{¦¡ùثŧi¤F
Dim mydata()  ¬°¦ó±µµÛ¤S«Å§i¤@¦¸ ReDim mydata(¸ê®Æªø«×)¡A¨ä¥Î·N¦ó¦b¡H
ÁÂÁ±z¡I

TOP

¦^´_ 3# c_c_lai
ReDim ³¯­z¦¡ ¦bµ{§Ç¼h¦¸¤¤¥Î¨Ó­«·s°t¸m°ÊºA°}¦CÅܼƪºÀx¦sªÅ¶¡¡C ¥i¬d¬ÝVba ªº»¡©ú

Dim mydata()  ¬°°ÊºA°}¦C
¶i¤Jµ{§Ç«á¥i¥H ¨Ì©Ò»Ý¦A¦¸«Å§i°}¦C¤¸¯Àªø«×
ReDim mydata(¸ê®Æªø«×)

TOP

  1. Sub ³]©w®æ¦¡()
  2. ³Ì«á¸ê®Æ¦æ = [A5].End(xlDown).Row
  3. ¸ê®Æªø«× = [A5].End(xlToRight).Column
  4. For i = 1 To ¸ê®Æªø«×
  5.   Set Rng = Range("A6:A" & ³Ì«á¸ê®Æ¦æ).Offset(0, i - 1)
  6.   Select Case Left(Cells(5, i), 1)
  7.   Case "%"
  8.      Rng.NumberFormatLocal = "0.00%"
  9.   Case "$"
  10.      Rng.NumberFormatLocal = "$#,##0.00"
  11.   Case "§A"
  12.      Rng.NumberFormatLocal = "G/³q¥Î®æ¦¡"
  13.   Case Else
  14.      Rng.NumberFormatLocal = "#,##0.00_ "
  15.   End Select
  16. Next
  17. End Sub
½Æ»s¥N½X

TOP

¦^´_ 3# c_c_lai


    ¦p¦PGBKEE¤j¸Ñ»¡¤@¼Ë

¥Î¦b°}¦Cªø«×¥i¯à·|Åܰʪº±¡ªp¤U ³o¼gªk «Ü¤è«K^^

TOP

¥»©«³Ì«á¥Ñ icestormer ©ó 2012-4-22 20:56 ½s¿è

¦^´_ 5# register313
·PÁ§AªºÀ°¦£ ¨Ó¸Õ¬Ý¬Ý^^

½Ð°Ý §Ú¥Î¤Fapplication.quit ¬O¥i¥Hª½±µÃö±¼EXCEL¦ýÃö¤§荝ÁÙ¬O·|°Ý§Ú­n¤£­n¦sÀÉ   
¨Ï¥Î application.displayalerts=false  «ç·|¨S¦³§@¥Î©O?(¤£·Q³Q°Ý¨ì¦³¨S¦³­n¦sÀÉ´N©y±µÃö³¬EXCEL)

application.displayalerts=false

  application.quit
application.displayalerts=true

TOP

¦^´_ 7# icestormer
ThisWorkbook.Save
Application.Quit
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

        ÀR«ä¦Û¦b : ¦³¤ß´N¦³ºÖ¡A¦³Ä@´N¦³¤O¡A¦Û³yºÖ¥Ð¡A¦Û±oºÖ½t¡C
ªð¦^¦Cªí ¤W¤@¥DÃD