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

[µo°Ý] ¦p¦ó§Q¥ÎVBA¦^¶Ç¤å¦r?

¦^´_ 1# leehom


    ¤£ª¾¹D§A©Ò¿×ªº¯S©w¤å¦r¬O¤°»ò¡H
¤£¹L§A¥i¥H§Q¥Î¤u§@ªí¨Æ¥ó¨Ó»s§@
  1. Private Sub Worksheet_Change(ByVal Target As Range)
  2. If Target.Address = "$B$1" Then
  3.     If Target = "" Then
  4.         Target.Offset(, -1) = ""
  5.     Else
  6.         Target.Offset(, -1) = Target & " DEF"
  7.     End If
  8. End If
  9. End Sub
½Æ»s¥N½X

TOP

¥»©«³Ì«á¥Ñ lpk187 ©ó 2015-9-15 22:34 ½s¿è

¦^´_ 3# leehom


    ¨Ì·Ó§A¶Ç¦^¼Æ¦r¡A¥i¥H§Q¥ÎTargetªº¦C¸¹(Row)¦^¶Ç
IJµo«h§ï¬°²Ä¤GÄæColumn = 2 ¡A¤]´N¬OBÄæ
  1. Private Sub Worksheet_Change(ByVal Target As Range)

  2. If Target.Column = 2 Then
  3.     If Target = "" Then
  4.         Target.Offset(, -1) = ""
  5.     Else
  6.         Target.Offset(, -1) = Target & " " & Target.Row
  7.     End If
  8. End If
  9. End Sub
½Æ»s¥N½X

TOP

¦^´_ 7# leehom


    ¾ã­Ó¨«¦V¿ù»~¤F¡A¤£À³¸Ó³o¼Ë¥h¼g
¤@­Ó°ÝÃD¬O­n¦Ò¼{«á¨Ó¨Ï¥ÎªÌ¸Ó¦p¦ó¿é¤J¡A§A²Ä¤@­Ó°ÝÃD¨ì«á­±³o¤@­Ó°ÝÃD¡A®¦¦Òªº¤è¦V§¹¥þ¤£¦P¤F¡C
  1. Sub worksheet_change(ByVal Target As Range)
  2.      If Target.Address = "$B$2" Then
  3.      Application.EnableEvents = False
  4.      i = Application.InputBox("How many numbers you want to add?", "Prompt", , , , , , 1) - 1
  5.      For j = Target.Row + 1 To Target.Row + i
  6.          Cells(j, Target.Column) = Left(Cells(j - 1, Target.Column), 5) & Right(Cells(j - 1, Target.Column), 7) + 1
  7.          Cells(j, Target.Column - 1) = Cells(j, Target.Column - 1).Row
  8.      Next
  9.      Application.EnableEvents = True
  10.      End If
  11. End Sub
½Æ»s¥N½X

TOP

¦^´_ 9# leehom
  1. Sub worksheet_change(ByVal Target As Range)
  2.      If Target.Address = "$B$2" Then
  3.      Application.EnableEvents = False
  4.         Cells(2, Target.Column - 1) = 1
  5.      i = Application.InputBox("How many numbers you want to add?", "Prompt", , , , , , 1) - 1
  6.      For j = Target.Row + 1 To Target.Row + i
  7.          Cells(j, Target.Column) = Left(Cells(j - 1, Target.Column), 5) & Right(Cells(j - 1, Target.Column), 7) + 1
  8.          Cells(j, Target.Column - 1) = Cells(j, Target.Column - 1).Row - 1
  9.      Next
  10.      Application.EnableEvents = True
  11.      End If
  12. End Sub
½Æ»s¥N½X

TOP

¦^´_ 13# leehom

§âCells(2, "A") = 1 §â³o¥y§ï¦¨    Cells(2, "A") = 1 & ")"

TOP

        ÀR«ä¦Û¦b : ¹D¼w¬O´£ª@¦Û§Úªº©ú¿O¡A¤£¸Ó¬O¨þ¥¸§O¤HªºÃ@¤l¡C
ªð¦^¦Cªí ¤W¤@¥DÃD