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

½ÐÀ°¦£¬Ý¤@¤U´¡¤JÄæ³o­Óµ{¦¡°ÝÃD¥X¦b­þ

½ÐÀ°¦£¬Ý¤@¤U´¡¤JÄæ³o­Óµ{¦¡°ÝÃD¥X¦b­þ

¦p Excel ÀÉ©Òªþªº¡@§Æ±æ¯à°µ¨ì "¿ï²Ä¤@¦C"¡B"¿ï²Ä¤G¦C" ¯ëªº®ÄªG
¦ý²{¦bµ{¦¡¼g¦n¤F¡@°õ¦æ®É«o¨S¦³´¡¤JªÅ¥ÕÄæ
¦]¬°¨S¦³¥X²{¿ù»~°T®§¡@©Ò¥H§Ú¤]¤£ª¾¹D­þ¸Ì¦³°ÝÃD
§Æ±æ¯àÀ°§Ú¬Ý¤@¤U
ÁÂÁ¡ã

´¡¤JÄæ.zip (11.16 KB)

¦^´_ 1# Genie
¿ï²Ä¤G¦C ªºÅÞ¿è¬Ý¤£À´
¿ï²Ä¤@¦C ¦p¤U
  1. Sub ´¡¤JÄæ()
  2.     Dim i As Integer, r As String, Rng As Range, E As Range
  3.     Dim iRow As Integer
  4.     If iRow > 3 Then Exit Sub '¦¹µ{¦¡½X¨S§@¥Î?? : iRow µ{¦¡¤¤§A©|¥¼µ¹­È
  5.     Application.ScreenUpdating = False
  6.     Do
  7.         r = InputBox("¿é¤J´¡¤JÄæ¼Æ,¥²¶· >= 1  ", "´¡¤JÄæ¼Æ", "1")
  8.     Loop Until r <> "" And r >= 1
  9.     For i = 2 To [A2].End(xlToRight).Column - 1
  10.         If Cells(1, i) <> Cells(1, i + 1) Then
  11.             If Rng Is Nothing Then Set Rng = Cells(1, i) Else Set Rng = Union(Cells(1, i), Rng)
  12.         End If
  13.     Next
  14.     If Not Rng Is Nothing Then
  15.         For Each E In Rng.Cells
  16.             E.Offset(, 1).Resize(, r).EntireColumn.Insert
  17.         Next
  18.     End If
  19.     Application.ScreenUpdating = True
  20. End Sub
½Æ»s¥N½X

TOP

¤£ºÞ¬O¿ï­þ¤@¦C
´N¬O¦b¬Û¦Pªº¤å¦r©Î­È«á­±´¡¤J >1 ªºªÅ¥ÕÄæ

¦p¿ï²Ä¤G¦C
¨º´N¦b 1¡B2¡B1¡B2¡B3¡B4 ªº«á­±´¡¤JªÅ¥ÕÄæ

TOP

¦^´_ 3# Genie
¸Õ¸Õ¬Ý
  1. Sub ´¡¤JÄæ()
  2.     Dim i As Integer, r As String, Rng As Range, E As Range
  3.     Dim iRow As Integer
  4.     iRow = Selection.Cells(1).Row
  5.     If iRow > 3 Or Selection.Cells(1) = "" Then Exit Sub
  6.     Application.ScreenUpdating = False
  7.     Do
  8.         r = InputBox("¿é¤J´¡¤JÄæ¼Æ,¥²¶· >= 1  ", "´¡¤JÄæ¼Æ", "1")
  9.     Loop Until r <> "" And r >= 1
  10.     Set Rng = Cells(iRow, Columns.Count).End(xlToLeft)
  11.     Do
  12.         If Rng <> Rng.Offset(, -1) Then
  13.             Set Rng = Rng.Offset(, -1)
  14.             Rng.Offset(, 1).EntireColumn.Resize(, r).Insert
  15.         Else
  16.             Set Rng = Rng.Offset(, -1)
  17.         End If
  18.     Loop While Rng.Column > 2
  19.     Application.ScreenUpdating = True
  20. End Sub
½Æ»s¥N½X
PS «ö¦^ÂÐÁä ¦^¤å ¬O¤@ºØ§»ª

TOP

¦^´_ 4# GBKEE

³o­Óµ{¦¡­Y­n¦b¦P­Ó sheet ³sÄò°õ¦æ¨â¦¸ªº¸Ü
¬O¤£¬O·|§â²Ä¤@¦¸°õ¦æªºªÅ¥ÕÄæ¤]·í°µ¤@Äæ¦A´¡¤J¡H
¨Ò¦p¥ý¿ï²Ä¤@¦C´¡¤JªÅ¥ÕÄæ¡@¦A¿ï²Ä¤G¦C´¡¤JªÅ¥ÕÄæ
µ²ªG·|§â²Ä¤@¦C´¡¤JªºªÅ¥ÕÄæ¡@¤]·í°µ¤@Äæ´¡¤J
¦pªþÀÉ©Ò¥Ü

½Ð°Ý¬O§_¥i¥H¤£§â²Ä¤@¦CªºªÅ¥ÕÄæ¤]·í§@¤@Äæ°µ´¡¤J©O¡H
ÁÂÁ¡ã

´¡¤JÄæ.zip (13.57 KB)

TOP

¦^´_ 5# Genie
§A­n¦b¦P¤@Sheet, §@¨â¦¸ªº´¡¤JÄæ,¦pªþÀɤWªº½d¨Ò,
¤£¦n·N«ä,§Ú·Q¤£¥Xµ{¦¡½XªºÅÞ¿è­n¦p¦ó¼g.

TOP

¦^´_ 1# Genie

§Aªº·N«ä¤£ª¾¬O§_¦p¦¹
  1. Sub InsertColumn()
  2. Dim k
  3. r = ActiveCell.Row
  4. 10
  5. k = InputBox("¿é¤J±ý´¡¤JÄæ¼Æ", "´¡¤JÄæ¼Æ", 1)
  6. If Not IsNumeric(k) Then MsgBox "½Ð¿é¤J¦³®Ä¼Æ­È ": GoTo 10
  7. i = Cells(r, 256).End(xlToLeft).Column
  8. Do Until i = 2
  9. If Cells(r, i) <> Cells(r, i - 1) And Cells(r, i - 1) <> "" And Cells(r, i) <> "" Then Cells(r, i).EntireColumn.Insert
  10. i = i - 1
  11. Loop
  12. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 7# Hsieh

¥i¥H°µ¨ì§Ú·Q­nªº¼Ë¤l¤F
¤£¹L¥u¥i¥H´¡¤J¤@Äæ¦Ó¤w¬O¶Ü¡H
¦]¬°§Ú¿é¤J 2¡@­n´¡¤J¨âÄæ
¦ý°õ¦æ¥X¨Óªºµ²ªG¥u¦³´¡¤J¤@Äæ¦Ó¤w

TOP

¦^´_ 8# Genie
§Ñ¤F¦³¦hÄæ­n¨D
  1. Sub InsertColumn()
  2. Dim k
  3. r = ActiveCell.Row
  4. 10
  5. k = InputBox("¿é¤J±ý´¡¤JÄæ¼Æ", "´¡¤JÄæ¼Æ", 1)
  6. If Not IsNumeric(k) Then MsgBox "½Ð¿é¤J¦³®Ä¼Æ­È ": GoTo 10
  7. i = Cells(r, 256).End(xlToLeft).Column
  8. Do Until i = 2
  9. If Cells(r, i) <> Cells(r, i - 1) And Cells(r, i - 1) <> "" And Cells(r, i) <> "" Then Cells(r, i).Resize(, k).EntireColumn.Insert
  10. i = i - 1
  11. Loop
  12. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

ÁÂÁ GBKEE ©M Hsieh ª©¤jªºÀ°¦£
¸Ñ¨M¤F§Úªº°ÝÃD
¤]Åý§Ú¾Ç²ß¤£¦Pªº¼gªk
³o´X­Óµ{¦¡§Ú·|¦n¦n¬ã¨sªº
«D±`ÁÂÁÂÀ°¦£¡ã

TOP

        ÀR«ä¦Û¦b : ¡i°µ¤Hªº¶}©l¡j¨C¤@¤Ñ³£¬O¬G¤Hªº¶}©l¡A¨C¤@­Ó®É¨è³£¬O¦Û¤vªºÄµ±§¡C
ªð¦^¦Cªí ¤W¤@¥DÃD