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

[µo°Ý] ½s¸¹¤è¦¡-­^¤å+¦~¤ë+¬y¤ô½s¸¹2½X.¥X¨Ó¨S«ö¶¶§Ç

[µo°Ý] ½s¸¹¤è¦¡-­^¤å+¦~¤ë+¬y¤ô½s¸¹2½X.¥X¨Ó¨S«ö¶¶§Ç

¥»©«³Ì«á¥Ñ kkooo15 ©ó 2019-8-11 23:47 ½s¿è

°ÝÃD¡R½s¸¹¤è¦¡-­^¤å+¦~¤ë+¬y¤ô½s¸¹2½X.¥X¨Ó¨S«ö¶¶§Ç
«ö·s¼Wªº®É­ÔÀ³¸Ó­n¸õC190805¡A¬°¤°»ò¥L·|¸õ¨ìC190813?

  1. Private Sub Button1_Click()
  2.     Call ·s¼W½s¸¹
  3. End Sub

  4. Private Sub Button3_Click()
  5.     Call ·s¼W¸ê®Æ
  6. End Sub
  7. Sub ·s¼W½s¸¹()
  8.     Set wSh = Sheets("¤u§@ªí1")
  9.     Dim i As Integer
  10.     i = 4
  11.     Do
  12.     i = i + 1
  13.         If wSh.Cells(i, 3) = "" Then Exit Do
  14.         If TBox1.Value = "C" & Application.Text(Date, "YYMM") & Right("00" & Number + 1, 2) Then
  15.         Number = Number + 1
  16.         End If
  17.         TBox1.Value = "C" & Application.Text(Date, "YYMM") & Right("00" & Number + 1, 2)
  18.     Loop

  19. End Sub

  20. Sub ·s¼W¸ê®Æ()
  21.     Set wSh = Sheets("¤u§@ªí1")
  22.     '¨¾§b
  23.     If TBox1 = "" Or TBox2 = "" Or TBox3 = "" Then MsgBox ("¸ê®Æ¿é¤J¤£¥þ¡C")   'µ²§ôµøµ¡´£¥Ü:Exit Sub
  24.     Dim i As Integer
  25.     i = 4
  26.     Do
  27.     i = i + 1
  28.     If wSh.Cells(i, 3) = "" Then Exit Do
  29.     If TBox1.Text = wSh.Cells(i, 3) Then
  30.         MsgBox ("¦X¬ù½s¸¹­«½Æ¡A½Ð­«·s¿é¤J¡C")   'µ²§ôµøµ¡´£¥Ü
  31.     Exit Sub
  32.     End If
  33.     Loop
  34.     k = 0
  35.     For j = 3 To 5
  36.     k = k + 1
  37.     wSh.Cells(i, j) = Me("TBox" & k).Value
  38.     Next
  39.     MsgBox ("½s¸¹" & TBox1.Text & "¦X¬ù¡A·s¼W§¹¦¨¡C") 'µ²§ôµøµ¡´£¥Ü
  40. End Sub
½Æ»s¥N½X
ªþ¥ó¡R
ZA0004015.rar (20.04 KB)
excel¾Ç²ß¤¤!¿v¥X¹Ú·Q
https://www.youtube.com/channel/UCPAiRNsHX3k_omp0YDgfDiA

¦^´_ 2# ikboy
«D±`ÁÂÁ¡A§âµ{¦¡Åܵu¤F¡A¦Ó¥B¤]§¹¦¨§Úªº»Ý­n¡C

µ{¦¡½X¦p¤U¡R
  1. Private Sub UserForm_Initialize()
  2.     Dim ym$, Myr&
  3.     'Long ªº«¬ºA«Å§i¦r¤¸¬° &
  4.     'String ªº«¬ºA«Å§i¦r¤¸¬° $
  5.     ym = "C" & Format(Date, "YYMM")
  6.     'ym = "C"¶}ÀY + ¦~(2½X)¤ë
  7.     Myr = [c65536].End(3).Row
  8.     'Myr = C¦æ³Ì¤U­±©¹¤W§ä¨ì¦³¦rªº¨º¤@®æ
  9.     a = Cells(Myr, "c")
  10.     'a = Cells(Myr¨º¦C,CÄæ)
  11.     TBox1.Value = ym & Format(IIf(Left(a, 5) = ym, Val(Right(a, 2)), 0) + 1, "00")
  12.     'TBox1 = ym=[c+¦~+¤ë] & C¦æ³Ì¤U­±©¹¤W§ä¨ì¦³¦rªº¨º¤@®æ¦pªG= ymªº«e5­Ó¦r¤¸
  13.     '´N5­Ó¦r¤¸«á­±¥[2½X¨Ã¥[1
  14.     '³Ì«á§â¸ê®Æ©ñ¨ìTBox1
  15. End Sub
½Æ»s¥N½X
Àɮצp¤U¡R(¦³»Ý­nªº¦Û¨ú)
ZA0004015-1.rar (23.54 KB)
excel¾Ç²ß¤¤!¿v¥X¹Ú·Q
https://www.youtube.com/channel/UCPAiRNsHX3k_omp0YDgfDiA

TOP

°N¬O½s¸¹¥i¥H²¤Æ¤@¤U:
  1. Private Sub UserForm_Initialize()
  2.     Dim ym$, Myr&
  3.     ym = "C" & Format(Date, "YYMM")
  4.     Myr = [c65536].End(3).Row
  5.     a = Cells(Myr, "c")
  6.     TBox1.Value = ym & Format(IIf(Left(a, 5) = ym, Val(Right(a, 2)), 0) + 1, "00")
  7. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : ±o²z­nÄǤH¡A²zª½­n®ð©M¡C
ªð¦^¦Cªí ¤W¤@¥DÃD