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

[µo°Ý] ¦U¦ì¥ý¶i¤j®a¦n¡A¦³­Ó¤p°ÝÃD·Q°Ý

¥»©«³Ì«á¥Ñ GBKEE ©ó 2013-9-13 10:50 ½s¿è

¦^´_ 1# wxad0285
³o a1 , b1 , c1 , d1 , e1 , f1 , g1 , h1 , i1  ªº¼Æ­È¦b­þ¸Ì,
Àˬdµ{¦¡½X«oÁ`¬O¥X²{"¸ê®Æ«¬ºA¤£¥¿½T"? ­þ¤@¦æµ{¦¡½X, ªþÀɤW¨Ó¤~²M·¡¿ù»~¦b­þ¸Ì.
  1. Worksheets("salary").Range("Y3").Value = a1 + b1 + c1 + d1 + e1 + f1 + g1 + h1 + i1
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2013-9-13 16:25 ½s¿è

¦^´_ 3# wxad0285
¸Õ¸Õ¬Ý
  1. Option Explicit
  2. Sub firstrecord()
  3.     Dim a As Integer, b As Integer, c As Integer, d As Integer, e As Integer
  4.     Dim a1 As Integer, b1 As Integer, c1 As Integer, d1 As Integer, e1 As Integer, f1 As Integer, g1 As Integer, h1 As Integer, i1 As Integer
  5.     Dim Sh As Worksheet, xRow As Integer, i As Integer
  6.     Set Sh = Sheets("salary")    '³o¸Ì³]¥ß¤u§@ªíÅܼƠ   '*** ¦p¤u§@ªí­n§ï¦WºÙ: ³oùاï¤@¦¸´N¥i¥H  *****
  7.    xRow = Application.CountA(Sh.Range("a:a"))            '¦³¸ê®ÆÀx¦s®æªº­p¼Æ
  8.    With Sh
  9.          .Cells(xRow + 1, "A") = xRow - 1                '½s¸¹: ¬°¦³¸ê®ÆÀx¦s®æªº­p¼Æ-1
  10.         For i = 1 To 12
  11.             '±NÀ³¤äª÷ÃB¶ñ¤J¡A¨Ã¬Û¹ïÀ³excelªºÀx¦s®æ' 1-10
  12.             If i <= 10 Then .Cells(xRow + 1, "A").Offset(, i) = UserForm1.Controls("Textbox" & i)
  13.             '±NÀ³¦©ª÷ÃB¶ñ¤J¡A¨Ã¬Û¹ïÀ³excelªºÀx¦s®æ' 11-22
  14.             .Cells(xRow + 1, "M").Offset(, i - 1) = UserForm1.Controls("Textbox" & i + 10)
  15.         Next
  16.     End With
  17.     '±NÀ³¤äª÷ÃB¬Û¥['
  18.     With UserForm1
  19.        'Àˬdµ{¦¡½X«oÁ`¬O¥X²{"¸ê®Æ«¬ºA¤£¥¿½T"? ->'·í±±¨î¶µ ¬°ªÅ¥Õ®É ¤£¥i§@¥|«h¹Bºâ
  20.         a = Val(.TextBox3)                    ' a ¤]¥i¥H = ¤u§@ªíªºÀx¦s®æ ,¤£¥²¥[ Val¨ç¼Æ
  21.         b = Val(.TextBox4) * Val(.TextBox5)   'Àx¦s®æ¬°ªÅ¥Õ®É¦Û°ÊÂର 0 ¥i§@¥|«h¹Bºâ
  22.         c = Val(.TextBox6) * Val(.TextBox7)
  23.         d = Val(.TextBox8) * Val(.TextBox9)
  24.         e = Val(.TextBox10)
  25.     'Åã¥Ü¥XÀ³¤äª÷ÃB¤p­p'
  26.         Sh.Range("L3").Value = a + b + c + d + e
  27.         .Label19 = Sh.Range("L3")
  28.     'Åã¥Ü¦U¶µ¥Ø¤p­p'
  29.         .Label35 = b
  30.         .Label34 = c
  31.         .Label13 = d
  32.     '±NÀ³¦©ª÷ÃB¬Û¥['
  33.         a1 = Val(.TextBox11)
  34.         b1 = Val(.TextBox12)
  35.         c1 = Val(.TextBox13)
  36.         d1 = Val(.TextBox14)
  37.         e1 = Val(.TextBox15)
  38.         f1 = Val(.TextBox22)
  39.         g1 = Val(.TextBox16) * Val(.TextBox17)
  40.         h1 = Val(.TextBox18) * Val(.TextBox19)
  41.         i1 = Val(.TextBox20) * Val(.TextBox21)
  42.     'Åã¥ÜÀ³¦©ª÷ÃB¤p­p'
  43.         Sh.Range("Y3").Value = a1 + b1 + c1 + d1 + e1 + f1 + g1 + h1 + i1
  44.         .Label42 = Sh.Range("Y3")
  45.     'Åã¥Ü¹ê¤äª÷ÃB'
  46.         .Label16 = .Label19 - .Label42
  47.         'Sh.Range("Y3")-Sh.Range("L3")   Àx¦s®æ¬°ªÅ¥Õ®É¦Û°ÊÂର 0
  48.        End With
  49. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2013-9-16 16:33 ½s¿è

¦^´_ 5# wxad0285
  ¦h¬Ý¬Ý,·|¬Ý¥X¬ªùªº
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 7# wxad0285
¤£¿ù,vba­n¶i¨B´N¬O­n¦p¦¹¬ã¨s
  1. Range ¶°¦X
  2. ¥Nªí¬Y¤@Àx¦s®æ¡B¬Y¤@Äæ¡B¬Y¤@¦C¡B¬Y¤@«ü©w½d³ò (¸Ó«ü©w½d³ò¥i¥]§t¤@­Ó©Î­Y¤z³sÄòÀx¦s®æ½d³ò) ©ÎªÌ¬Y¤@¥ßÅé½d³ò¡C
½Æ»s¥N½X
Cells(¦C¯Á¤Þ,Äæ¯Á¤Þ)  ->Cell(xRow+1, "A")   , ¦C¯Á¤Þ¥²¶·¬O¼Æ¦r,Äæ¯Á¤Þ¥i¥H¬O¼Æ¦r©Î¤å¦r
  1. Option Explicit
  2. Sub Ex()
  3.   With Range("D10:F15")
  4.     .Select
  5.     MsgBox .Range("A" & .Rows.Count).Address
  6.     MsgBox .Cells(.Rows.Count, 1).Address
  7.     MsgBox .Range("C6").Address
  8.     MsgBox .Cells(.Rows.Count, .Columns.Count).Address
  9. End With
  10. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : ¦¨¥\¬OÀuÂIªºµo´§¡A¥¢±Ñ¬O¯ÊÂIªº²Ö¿n¡C
ªð¦^¦Cªí ¤W¤@¥DÃD