excel vba ¦pªG§â¤GÄ檺¸ê®Æcopy¨ì¥t¤GÄæ©O?
- ©«¤l
- 9
- ¥DÃD
- 6
- ºëµØ
- 0
- ¿n¤À
- 15
- ÂI¦W
- 0
- §@·~¨t²Î
- win7
- ³nÅ骩¥»
- excel2013
- ¾\ŪÅv
- 10
- µù¥U®É¶¡
- 2019-1-23
- ³Ì«áµn¿ý
- 2019-2-1
|
excel vba ¦pªG§â¤GÄ檺¸ê®Æcopy¨ì¥t¤GÄæ©O?
½Ð°Ý¦U¦ì¥ý¶i:
§Ú·Qn¥ý§âexcelªº¤GÄæ(B, C)¸ê®Æcopy¨ì¥t¤GÄæ(E, F)¡A
µM«á¡A·í¼ÆÈ1©Î¼ÆÈ2¤GÄæ(B, C)¥ôÀx¦s®æ¦³Åܧó®É¡A(E, F)ÄæÀxȮ椺®e·|¸òµÛ§ïÅÜ¡C
§Ú¦³·Q¨ì¨Ï¥Î Worksheet_Change¤è¦¡¡A¦ý¤£ª¾n«ç»ò¼gvba
|
|
|
|
|
|
|
- ©«¤l
- 3
- ¥DÃD
- 0
- ºëµØ
- 0
- ¿n¤À
- 2
- ÂI¦W
- 0
- §@·~¨t²Î
- windows7
- ³nÅ骩¥»
- office 2016
- ¾\ŪÅv
- 10
- µù¥U®É¶¡
- 2019-3-7
- ³Ì«áµn¿ý
- 2019-3-10
|
±z¦n¡A¸ÕµÛ¼g¤F£¸Ó²³æªº¡AÅwªï°ª¤â«ü¥¿
¨ìVBA¸Ó¤u§@ªí¤U
Private Sub Worksheet_Change(ByVal Target As Range)
Dim E As Long
E = WorksheetFunction.CountA(Range("B:B")) + 1
Range("E1:F" & E).Value = Range("B1:C" & E).Value
End Sub |
|
|
|
|
|
|
- ©«¤l
- 6
- ¥DÃD
- 2
- ºëµØ
- 0
- ¿n¤À
- 50
- ÂI¦W
- 285
- §@·~¨t²Î
- windows
- ³nÅ骩¥»
- office2016
- ¾\ŪÅv
- 20
- µù¥U®É¶¡
- 2019-9-6
- ³Ì«áµn¿ý
- 2024-12-5
|
ª½±µE2¿é¤J =B2
¦A¦V¤U¦V¥k½Æ»s¨ìF5
µL¶·VBA¬O§_§ó²³æ |
|
|
|
|
|
|
- ©«¤l
- 13
- ¥DÃD
- 4
- ºëµØ
- 0
- ¿n¤À
- 50
- ÂI¦W
- 0
- §@·~¨t²Î
- WIN10
- ³nÅ骩¥»
- Office365
- ¾\ŪÅv
- 20
- µù¥U®É¶¡
- 2020-4-1
- ³Ì«áµn¿ý
- 2022-4-7
|
¦^´_ 2# a1234z
¹ê»Ú¹B¦æ®É¡Aµo²{·|·í¾÷¡AÀ³¸Ó¬OIJµo°ÝÃD
קï¦p¥H¤Uµ{¦¡½X¡A´NOK¤F
´£¨Ñ°Ñ¦Ò¡A¦pªG¦³¨ä¥L¼gªk¡A¤]½Ð¦U¦ì«ü±Ð
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Dim E As Long
E = WorksheetFunction.CountA(Range("B:B")) + 1
Range("E1:F" & E).Value = Range("B1:C" & E).Value
Application.EnableEvents = True
End Sub |
|
|
|
|
|
|
- ©«¤l
- 16
- ¥DÃD
- 2
- ºëµØ
- 0
- ¿n¤À
- 55
- ÂI¦W
- 0
- §@·~¨t²Î
- macOS / Windows
- ³nÅ骩¥»
- Office 2010/2019
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2020-7-9
- ³Ì«áµn¿ý
- 2021-8-7
|
¥»©«³Ì«á¥Ñ cody ©ó 2020-7-23 00:58 ½s¿è
°Ñ¦Ò¬Ý¬Ý
module:- Sub copyBCtoEF()
- With Worksheets("test1")
- .Range("E:F").Value = .Range("B:C").Value
- End With
- End Sub
½Æ»s¥N½X- Sub doUNDO()
- With Application
- .EnableEvents = False
- .Undo
- .EnableEvents = True
- End With
- End Sub
½Æ»s¥N½X worksheet:- Private Sub Worksheet_Change(ByVal Target As Range)
- Application.EnableEvents = False
-
- If Target.Row = 1 Then
- doUNDO
- MsgBox "¤£¥i§ó§ï¼ÐÃD"
- GoTo tagExit
- End If
-
- If (Target.Column = 2 Or Target.Column = 3) And (Target.Row >= 2 Or Target.Row >= 2) And Target.Count = 1 Then
- With Worksheets("test1")
- .Cells(Target.Row, Target.Column + 3).Value = .Cells(Target.Row, Target.Column).Value
- End With
- GoTo tagExit
- End If
-
-
-
- If (Target.Column = 2 Or Target.Column = 3) And (Target.Row >= 2 Or Target.Row >= 2) And Target.Count >= 2 Then
-
- With Worksheets("test1")
- .Range(.Cells(Target.Row, Target.Column + 3), .Cells(Target.Row + UBound(Target.Value2, 1) - 1, Target.Column + UBound(Target.Value2, 2) - 1 + 3)).Value = Target.Value2
- End With
- GoTo tagExit
- End If
-
- tagExit:
- Application.EnableEvents = True
- End Sub
½Æ»s¥N½X |
|
|
|
|
|
|