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

[µo°Ý] ¦p¦ó¥ÎVBA §âSUBOROUTINE¼g¤J¯S©wWORKSHEET¡H

¥»©«³Ì«á¥Ñ ¤p«L«È ©ó 2015-10-12 17:50 ½s¿è

¦^´_ 10# stillfish00


  Ãö©ó²Ä2¡B3ÂI¡A§Ú¦^¥h¦A¸Õ¸Õ¡AÁÂÁÂ

¦Ó²Ä¤@ÂI¡A§Úµo²{§Ú¦b²¤Æ¤W¸üµ{¦¡®É¦h§R¤F¤@¥y¡A¹ê»Úµ{¦¡¡G
  1. With Out
  2. .Columns(1).ColumnWidth = 35
  3. .Range(Out.Cells(1, 2), .Cells(Out.Cells(10000, 1).End(xlUp).Row, .Cells(1, 100).End(xlToLeft).Column)).ColumnWidth = 10
  4. Outline.ShowLevels RowLevels:=0, ColumnLevels:=1
  5. End With
½Æ»s¥N½X
³Â·Ðstillfish00¤j¥i¥H¥[¦^¡u.Outline.ShowLevels RowLevels:=0, ColumnLevels:=1¡v¦A¸Õ¶Ü¡H
³o¥yªº¥Øªº¬O²¤ÆÅã¥Ü¡A¦ý¦n¹³µ{¦¡¦³¤F³o¥y«á¡A§Y¨Ï¤â°Ê§R°£Äd T:ND ­«¶]¡AUsedRange.Address Åã¥Ü ¤]¤£¥¿½T.....

TOP

¥»©«³Ì«á¥Ñ ­ã´£³¡ªL ©ó 2015-10-12 18:36 ½s¿è

¦^´_ 8# ¤p«L«È


On Error Resume Next
Out.UsedRange.EntireColumn.Delete¡@'¥[³o¦æ¡@
Out.Cells.Clear
Out.Columns.Ungroup
Out.Cells.EntireColumn.Hidden = False
Out.UsedRange.Delete¡@'¥[³o¦æ¡@

³oÃä´ú³£¥i¥Hªº¡ã¡ã

¥t­Ó§@ªk¡]½d¥»¤Þ¥Î¡^¡G¡@
ªÅ¥Õ¤u§@ªí+¶K¦n¤u§@ªí¨Æ¥óVBA¡A©R¦W¬°¡eTMP¡f¡A
«Ø¥ß·s¸ê®Æ®É¡A§R°£Âªí¡A½Æ»s¦¹ªí­«©R¦W¡ã¡ã

TOP

¥»©«³Ì«á¥Ñ ¤p«L«È ©ó 2015-10-13 09:18 ½s¿è

¦^´_ 12# ­ã´£³¡ªL


ª©¤j¡A«Ü©êºp¡A§Ú¦b²¤Æ¤W¸üµ{¦¡®É¦h§R¤F¤@¥y¡G¡u.Outline.ShowLevels RowLevels:=0, ColumnLevels:=1¡v¡A§ÚÁÙ¬O­«·s¤W¸üµ{¦¡µ¹¦U¦ì¤j¤j«ü±Ð......

¦³¤F³o¤@¥y«á¡A¥Î¤F§A´£Ä³ªº¥N½X¤]¸Ñ¨M¤£¤Fusedrange.address¿ù»~ªº°ÝÃD


¦Ü©ó½d¥»§@ªk¡A§Ú¨S´¿¨Ï¥Î¹L½d¥»¡AÁÙ¥H¬°½d¥»»Ý­n¦b¦P¤@¹q¸£¨Ï¥Î¡A¦Ó§Ú»Ý­n¦b¤£¦P¹q¸£¨Ï¥Î¡A­n¦Aª¦¤å¬Ý¬Ý¡A¥ýÁ¤F¡C

temp_v2.zip (91.36 KB)

TOP

¦^´_ 13# ¤p«L«È

§Ú¥u¯à´ú¸Õ§R°£­ì¦³¸ê®Æ¤Î¸Ñ°£¸s²Õ,
§Y¨Ï¥Î¥[¤J:.Outline.ShowLevels RowLevels:=0, ColumnLevels:=1
Out.UsedRange.Address ¤]¬O $A$1 µL»~~~

©Ò¿×ªº¡e½d¥»¡f¡A«üªº¬O¡e¤u§@ªí½d¥»¡f¡A³oªí¬O¦b¦P¤@Àɮתº¡A
±z¥i¤â°Ê·s¼W¤@¤u§@ªí¡A©R¦W¬°¡eTMP¡f¡A±N¡eOutput¡fµ{¦¡½X¶K¤J¡A§Y¬°¤@½d¥»¤u§@ªí¡A

­n°õ¦æµ{¦¡®É¡A¦A¡eCall ©I¥s¡f¥H¤U°Æµ{¦¡¡G¡@
Sub NewOutput()
On Error Resume Next
Application.DisplayAlerts = False
With ThisWorkbook
¡@¡@¡@.Sheets("Output").Delete
¡@¡@¡@.Sheets("TMP").Copy After:=.Sheets(.Sheets.Count)
¡@¡@¡@.Sheets(.Sheets.Count).Name = "Output"
End With
Application.DisplayAlerts = True
End Sub

³o¥i¥H¡G
¢°¡D§R°£Â¡eOutput¡f¤u§@ªí
¢±¡D½Æ»s¡eTMP¡f¤u§@ªí¡A­«·s©R¦W¡eOutput¡f

¨C¦¸³£¬O§¹¥þªÅ¥Õªº¤u§@ªí¡A¤]¸Ñ¨MSelection_Changeµ{¦¡½Xªº°ÝÃD¡I

TOP

¥»©«³Ì«á¥Ñ ¤p«L«È ©ó 2015-10-13 12:16 ½s¿è

¦^´_ 14# ­ã´£³¡ªL

©_©Ç¤F¡A¦pªG¬O¥ÎTEMP_V2ªºÀɮסA
²Ä¤@¦¸°õ¦æµ{¦¡¡A¿é¤J¡u1¡v¡AMSG¬O¡u$A1:$T$31¡v
¦A«ö¡uCTRL+Q¡v¡A¿é¤J¡u1¡v¡AMSGBOX ¬O¡u$A1:$AK$31¡v
¦A«ö¡uCTRL+Q¡v¡A¿é¤J¡u1¡v¡AMSGBOX ¬O¡u$A1:$BC$31¡v
¦ý§Ú¹w´ÁªºMSGBOX¬O¡u$A$1:$S$31¡v¡A¦]¬°¥u¦³$A$1:$S$31¤~¦³¸ê®Æ¹À.....

§Ú¬O¥ÎOFFICE 2010¡A¬°¤°»ò·|¦³¤£¤@¼Ëªºµ²ªG¡H
§Ú§â§Úªº´ú¸ÕPOST¦bYOUTUBE¡A½Ð¤j®a¬Ý¬Ý¡G
https://www.youtube.com/watch?v=deM3JvNEeuY&feature=youtu.be
¥N½X¬O©Mtemp_v2ªº§¹¥þ¤@¼Ë.....
¤]¦³¥[¤W¤j¤jªº
  1. On Error Resume Next
  2. Out.UsedRange.EntireColumn.Delete  '¥[³o¦æ
  3. Out.Cells.Clear
  4. Out.Columns.Ungroup
  5. Out.Cells.EntireColumn.Hidden = False
  6. Out.UsedRange.Delete  '¥[³o¦æ
½Æ»s¥N½X
½d¥»ªº¥\¯à¤£¿ù¡A¬Ý¨Ó¥i¥H¤@¸Õ¡AÁÂÁª©¤j¡C

TOP

¥»©«³Ì«á¥Ñ stillfish00 ©ó 2015-10-13 13:51 ½s¿è

¦^´_ 15# ¤p«L«È
¬Ý¨Ó¬Oexcelªº°ÝÃD¡A§Ú§â¤â°Ê­«²{°ÝÃD¨BÆJ´y­z¦p¤U
§Ú¤]¬Oexcel2010¡A¨ä¥Lª©¥»¥i¸Õ¸Õ:
1. ¶}·s¤u§@ªí
2. ¿ï B:D Äæ¡A§ó§ïÄæ¼e
3. ¿ï B:D Äæ¡A¸s²Õ
4. ÂI¿ï¸s²Õ¥ªÃ䪺1(²Ä¤@¼h)
5. ÂI¿ï¸s²Õ¥ªÃ䪺2
6. ¨ú®ø¸s²Õ
7. §R°£ B:D Äæ
8. VBA °õ¦æ MsgBox ActiveSheet.UsedRange.Address

¦n¹³¥u­n¦³°Ê¹L¸s²ÕªºÄæ¼e¡A ¤S¥hºPÅ|¸s²Õ¡A¤§«á´N²M¤£°®²b¤F(§R°£¤]µL®Ä)
ªí¹F¤£²M¡BÃD·N¤£©ú½T¡B¨SªþÀɮ׮榡¡B¨S¦³°Q½×°ÝÃDªººA«×~~~~~~¥H¤W·R²ö¯à§U¡C

TOP

¦^´_ 15# ¤p«L«È


   ¦]¬°¨ä¤¤¦³¤@¥yOut.Columns("B:D").Insert ´¡¤JÀx¦s®æ½d³ò¡A¦Ó¤@ª½¼W¥[¨Ï¥Î°Ï°ìªº¡I
­Y¸ÕµÛ§â³o¥yµù¸Ñ±¼¡A´N¤£·|¼W¥[¤Fusedrange

TOP

¦^´_ 16# stillfish00
­ì¨Ó¦p¦¹¡A¦pªG¯u¬OEXCELªºBUG¡A¨º»ò§Ú­Ì¤]¨S¦³¤èªk­«³]usedrange¡A°ß¦³¥t¦æ¥Lªk
¤j¤j´£Ä³ªºWorkbook_SheetSelectionChange©Îª©¤j´£Ä³ªº½d¥»¦n¹³¥i¦æ¡A¥u­n§Ú§âCODE©ñ¦bWORKBOOK¡A¨C¦¸§âªºOUTPUT§R±¼«K¥i¥H
¥t¥~¡AQUERYTABLE¥[¤F.delete¦n¹³¯uªºÅܧ֤F¡A§Ú¦A¤£¥Î©w´Á§R°£WORKSHEET¤F.....

³Ì«áÁÙ¬OÁÂÁ¤j®aªº¨ó§U~

TOP

¦^´_ 17# lpk187


    À³¸Ó¤£¬O¡A¤W­±stillfish00¤j¤jªº¤â°Ê°Ê§@¨S¦³¥[¤Jinsert°Ê§@¡A¦ýusedrange¤´µM¥X¿ù
§Ú·QÀ³¸Ó¬Ostillfish00±À½×¡G½Õ¾ãÄæÁï¡BGROUP©MUNGROUP¦P®É¨Ï¥Î«á¡Ausedrange«KµLªk­«³]

TOP

¦^´_ 19# ¤p«L«È

§A¤£Ä±±o©_©Ç¶Ü¡H¬°¤°»ò¨C¦¸¼WªºÄæ©M§A´¡¤Jªº¤@¼Ë¦h¶Ü¡H

TOP

        ÀR«ä¦Û¦b : §Ú­Ì­n°µ¦nªÀ·|ªºÀô«O¡A¤]­n°µ¦n¤º¤ßªºÀô«O¡C
ªð¦^¦Cªí ¤W¤@¥DÃD