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

[µo°Ý] ¦³Ãö VBA ©ñ¤J ¬Y EXCEL ªº¤u§@ªí¤¤¤@¨Æ

[µo°Ý] ¦³Ãö VBA ©ñ¤J ¬Y EXCEL ªº¤u§@ªí¤¤¤@¨Æ

©êºp~~°Ý­Ó«D±`°ò¥»ªº°ÝÃD

¦]¬°¤£¼ô EXCEL ©Ò¥H¦b¶Q°Q½×°Ï¤¤¹³­ÓµLÀY»aÃǨì³B§ä§Ú­nªº»yªk..
¦ý¬O¤S¤£ª¾¦p¦ó¦ê¶i§Ú¦Û¤v¥­±`¥Îªºexcel ªí¤¤

¥Ø«e§Ú±`¥ÎªºEXCEL ªºÀɮפ¤ ¦³¤­­Ó¤À­¶  
²Ä¤@­Ó¤À­¶  ¬O      °l³fªí   (¦³¼Ï¯Ã¤ÀªR¥\¯à)
²Ä¤G­Ó¤À­¶  ¬O      «È¤áÁʶRÁ`­p    (¦³¼Ï¯Ã¤ÀªR¥\¯à)
²Ä¤T­Ó¤À­¶  ¬O      ·|­û¸ê®Æªí    ( ³æ¯Â¸ê®Æ )
²Ä¥|­Ó¤À­¶  ¬O      ¥X³f¦a§}²M³æ  (¦³®MVLOOKUP )
²Ä¤­­Ó¤À­¶  ¬O      ±ÄÁʲM³æ    ³o¬O§Ú·Q­n©ñ¤J GBKEE ¤j¤§«e¦b§Oªº°Q½×¦ê¯d¤Uªº µ{¦¡½X..

¦ý¬O§Ú¸ÕµÛ¥h¶K¤W¥N½X¨Ã°õ¦æ.. ¨ÃµLªk¦¨¥\¡H  
³o¬qµ{¦¡½X¦b·sªº¤À­¶¤¤½T¹ê¬O¯à¥Îªº, ¬°¦ó¦³·|³o­Óª¬ªp


¨Ì ·Ó³o¬qµ{¦¡½X..  §Ú·Q¦b ²Ä¤­¤À­¶ªº F ¦C  Key in °Ó«~½s¸¹
¦b°õ¦æ¥¨¶°«á, ¼´ D:\PIC ¦PÀɦWªº·Ó¤ù¨ì  G ¦C
½Ð°Ý§Ú¬O¨ºÃ䦳°õ¦æ¤Wªº¿ù»~¶Ü¡H
  1. Option Explicit
  2. Sub ChangeSize()
  3.     Dim Mypath As String, E As Range, i As Integer ', MyPic As Object
  4.     Mypath = "D:\PIC\"
  5.     With Sheets("±ÄÁʲM³æ")
  6.         .Pictures.Delete
  7.         For i = 1 To 7 Step 3   'AÄæ ->1,DÄæ ->4,GÄæ ->7
  8.             For Each E In .UsedRange.Columns(i).Cells  ' 'AÄæ ->1,DÄæ ->4,GÄæ ->7
  9.                
  10.                 E.ColumnWidth = 25      '½Õ¾ãÀx¦s®æ¼e«×
  11.                 E.RowHeight = 50        '½Õ¾ãÀx¦s®æ°ª«×
  12.                
  13.                 If Dir(Mypath & E & ".jpg") <> "" Then
  14.                     'Set MyPic = ActiveSheet.Pictures.Insert(Mypath & E & ".jpg")
  15.                     With .Pictures.Insert(Mypath & E & ".jpg")
  16.                         .ShapeRange.LockAspectRatio = msoFalse
  17.                         .Left = E.Cells(1, 2).Left
  18.                         .Top = E.Cells(1, 2).Top
  19.                         .Width = E.Cells(1, 2).Width   '=Àx¦s®æ¼e«×
  20.                         .Height = E.Cells(1, 2).Height '=Àx¦s®æ°ª«×
  21.                     End With
  22.                 End If
  23.             Next
  24.         Next
  25.     End With
  26. End Sub
½Æ»s¥N½X

©êºp~~°Ý­Ó«D±`°ò¥»ªº°ÝÃD

¦]¬°¤£¼ô EXCEL ©Ò¥H¦b¶Q°Q½×°Ï¤¤¹³­ÓµLÀY»aÃǨì³B§ä§Ú­nªº»yªk..
¦ý¬O¤S¤£ ...
justinbaba µoªí©ó 2014-11-3 17:30

UsedRange ¦¹ª«¥ó¥Nªí«ü©w¤u§@ªí¤¤ªº¤w¥Î½d³ò
©Ò¥H·í¤u§@ªí¤¤¤w¦³¸ê®Æ®É,
¨Ã¤£¤@©w¬O§ì AÄæ ,DÄæ ,GÄæ,
¦Ó¬O§ì¦³¸ê®Æ°Ï°ì¤¤ªº²Ä1Äæ,²Ä4Äæ »P ²Ä7Äæ.

¸Ó¦¡¥i§ï¬° :
For Each E In .Cells.Columns(i)  ' 'AÄæ ->1,DÄæ ->4,GÄæ ->7

TOP

UsedRange ¦¹ª«¥ó¥Nªí«ü©w¤u§@ªí¤¤ªº¤w¥Î½d³ò
©Ò¥H·í¤u§@ªí¤¤¤w¦³¸ê®Æ®É,
¨Ã¤£¤@©w¬O§ì AÄæ ,DÄæ ,GÄæ, ...
luhpro µoªí©ó 2014-11-4 23:49


ÁÂÁ¤j¤j¦^ÂÐ..

­è¤~¸Õ¥Î¤F¤@¤U¤j¤j«Øijªºµ{¦¡½X..

¥X²{¤F "«¬ºA¤£²Å¦X" ªº¿ù»~°T®§­C...¥i§_¦A«üÂI¤@¤G©O¡H
  1. Option Explicit
  2. Sub ChangeSize()
  3.     Dim Mypath As String, E As Range, i As Integer ', MyPic As Object
  4.     Mypath = "\C:\Users\leon\Desktop\Test\"
  5.     With Sheets("·Ó¤ù¯Á¤Þ")
  6.         .Pictures.Delete
  7.         For i = 1 To 7 Step 3   'AÄæ ->1,DÄæ ->4,GÄæ ->7
  8.             
  9.             For Each E In .Cells.Columns(i)  ' 'AÄæ ->1,DÄæ ->4,GÄæ ->7
  10.                
  11.                 E.ColumnWidth = 25      '½Õ¾ãÀx¦s®æ¼e«×
  12.                 E.RowHeight = 50        '½Õ¾ãÀx¦s®æ°ª«×
  13.                
  14.                 If Dir(Mypath & E & ".jpg") <> "" Then
  15.                     'Set MyPic = ActiveSheet.Pictures.Insert(Mypath & E & ".jpg")
  16.                     With .Pictures.Insert(Mypath & E & ".jpg")
  17.                         .ShapeRange.LockAspectRatio = msoFalse
  18.                         .Left = E.Cells(1, 2).Left
  19.                         .Top = E.Cells(1, 2).Top
  20.                         .Width = E.Cells(1, 2).Width   '=Àx¦s®æ¼e«×
  21.                         .Height = E.Cells(1, 2).Height '=Àx¦s®æ°ª«×
  22.                     End With
  23.                 End If
  24.             Next
  25.         Next
  26.     End With
  27. End Sub
½Æ»s¥N½X

TOP

¥»©«³Ì«á¥Ñ luhpro ©ó 2014-11-5 22:10 ½s¿è

¦^´_ 3# justinbaba
For Each E In .Cells.Columns(i)
¹ê´úµo²{ .Columns(i) «á­±¨S¦³¥[¤W .Cells ,
·|Åܦ¨«ü©w¾ãÄæ¦Ó«D³æ­ÓÀx¦s®æ,
©Ò¥H·|¦³¿ù»~.

¤£¹L³o»P§Ú¹w´Áªºµ²ªG¤£¦P,
¨Ï¥ÎRangeÅܼƳz¹L For Each ¹ï¾ãÄ檺¤¸¯À°µ³v¤@³B²z,
¸ÑªR«á³B²zªº¤¸¯À«oÁÙ¬O¾ãÄæ?
§Ú¦³¨Ç¯Ç´e.

¦Ü©ó¨º¦æ Mypath = "\C:\Users\leon\Desktop\Test\" ©Ç©Çªº,
C: «e­±¤£À³¸Ó¦³ \ ¥X²{.

Æ[¹î§Aªºµ{¦¡¹ï¾ã­Ó¤u§@ªíªº¨C¤@¦C³£¦³°µ°ª«×³]©w,
³oÀ³¸Ó¤£¬O§A·Q­nªºµ²ªG.
«Øij­­¨îµ{¦¡¹ê»Ú·|§@¥Î¨ìªº½d³ò,
ÁקK¦³«D©Ò¹w´Á¬Æ¦Ü¬O¦h¾lªº°Ê§@©ìªø§@·~®É¶¡,
³o­Ó¥i¥Î  .Cells(Rows.Count, l).End(xlUp).Row ¤è¦¡¨Ó¨ú±o³Ì©³ºÝ¦³¸ê®Æªº¦C¸¹.

ÁÙ¦³¹ï¥Î©ó ¦C¸¹ ªí¥ÜªºÅܼÆ,
«Øij¤£½×¹ê»Ú¤W·|¨Ï¥Î¨ì¦h¤jªº¦C¸¹,
³£­n "¾i¦¨²ßºD" ¤@«ß³]¬° Long ¦Ó«D Integer,
¦]¬°·|¦³ ·¸¦ì(¶W¹L¥iªí¥Ü¼Æ¦rªº³Ì¤j­È) ªº­·ÀI.

³Ì«á³o¨â¦æ :
  E.ColumnWidth = 25      '½Õ¾ãÀx¦s®æ¼e«×
  E.RowHeight = 50        '½Õ¾ãÀx¦s®æ°ª«×
³]©wªº¼e«×¬O§@¥Î¨ì¦s©ñ¹ÏÀɦWºÙªºÀx¦s®æ,
¦Ó«D©ñ¸m¹Ï¤ùªºÀx¦s®æ,
§Ú²qÀ³«D§A·Q­nªºµ²ªG.
«Øij§ï¬°
  E.Cells(1, 2).ColumnWidth = 25      '½Õ¾ãÀx¦s®æ¼e«×
  E.Cells(1, 2).RowHeight = 50        '½Õ¾ãÀx¦s®æ°ª«×

ºî¤W©Ò­z«Øijµ{¦¡­×§ï¦p¤U
  1. Sub ChangeSize()
  2.     Dim Mypath As String, E As Range, l As Long, m As Long ', MyPic As Object
  3.     Mypath = "C:\Users\user12\Pictures\"
  4.     With Sheets("·Ó¤ù¯Á¤Þ")
  5.         .Pictures.Delete
  6.         For l = 1 To 7 Step 3   'AÄæ ->1,DÄæ ->4,GÄæ ->7
  7.             m = .Cells(Rows.Count, l).End(xlUp).Row
  8.             For Each E In Range(.Cells(1, l), .Cells(m, l)) ' 'AÄæ ->1,DÄæ ->4,GÄæ ->7
  9.                 E.Cells(1, 2).ColumnWidth = 25      '½Õ¾ãÀx¦s®æ¼e«×
  10.                 E.Cells(1, 2).RowHeight = 50        '½Õ¾ãÀx¦s®æ°ª«×
  11.                 If Dir(Mypath & E & ".jpg") <> "" Then
  12.                     'Set MyPic = ActiveSheet.Pictures.Insert(Mypath & E & ".jpg")
  13.                     With .Pictures.Insert(Mypath & E & ".jpg")
  14.                         .ShapeRange.LockAspectRatio = msoFalse
  15.                         .Left = E.Cells(1, 2).Left
  16.                         .Top = E.Cells(1, 2).Top
  17.                         .Width = E.Cells(1, 2).Width   '=Àx¦s®æ¼e«×
  18.                         .Height = E.Cells(1, 2).Height '=Àx¦s®æ°ª«×
  19.                     End With
  20.                 End If
  21.             Next
  22.         Next
  23.     End With
  24. End Sub
½Æ»s¥N½X

TOP

¦^´_  justinbaba
For Each E In .Cells.Columns(i)
¹ê´úµo²{ .Columns(i) «á­±¨S¦³¥[¤W .Cells ,
·|ÅÜ ...
luhpro µoªí©ó 2014-11-5 21:55


ÁÂÁÂluhpro¥S ¦^ÂÐ , ¤º®e¤Ó²`.. §ÚÁÙ±o®ø¤Æ¤@¤U..  §Ú¸Õ¸Õ«á¦A¦^³øª¬ªp ^ ^

TOP

        ÀR«ä¦Û¦b : ¡i¬°µ½Ävª§¡j¤H¥Í­n¬°µ½Ävª§¡A¤À¬í¥²ª§¡C
ªð¦^¦Cªí ¤W¤@¥DÃD