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

[µo°Ý] ¦p¦ó¦bªÑ»ù¹Ï¤U¤èÀ³¥Î VBA ¼W¦C¤@©ÔÅQ¡H

[µo°Ý] ¦p¦ó¦bªÑ»ù¹Ï¤U¤èÀ³¥Î VBA ¼W¦C¤@©ÔÅQ¡H

½Ð±Ð½Ñ¦ì¥ý¶i¡A¦p¦ó¯à¦bªÑ»ù¹Ï¤U¤è (¦pªþ¹Ï) À³¥Î VBA »yªk¨Ó¼W¦C¤@©ÔÅQ (ScrollBar)¡H
¡A¥ý«e GBKEE ª©¤j¦³­Ó½d¥»µ¹§Ú¡A¦ý¬O®³¨ÓÀ³¥Î¦b¦¹³B«o¤£¦¨¥\¡A
¥ú¬O  .ScrollBar1.Min = 1  ªº«Å§i´NµL¯e¦Ó²×¡A§ó¦óªp±µ¤U¥h¤F¡A
­n©Ç¥u¯à©Ç¦Û­Ó¨à¥\¤O¤£¦æ¡I  ªþ¤WÀɮסAÁÂÁ½Ѧì¥ý¶i«ü¾É¡I

ªÑ²¼¹Ïªí»P©ÔÅQ.rar (150.33 KB)

c_c_lai¤j
·Q½Ð°Ý±z³o®M¤ÀªR¨t²Î¥i§_¤À¨É,
§@¬°¤p§Ì¨t²Î«Ø¸mªº°Ñ¦Ò¥Î©O
[email protected]

TOP

¦^´_ 18# alexliou
Alex¥S¡A
ÁÂÁ±z¡A§Ú¸ÕµÛ¦bµ{¦¡°õ¦æ¶¥¬q§Q¥ÎVBA Code«Ø¸m¥¦¡A¥¦¤£¶È¥Rº¡µÛ Tricky, ¦Ó¥BÁÙ Difficult to manage,
©Ò¥H§ÚÁÙ¬O°µ­Ó¨ÄÄ_Ä_¨Ï¥Î­ì¥»ªº ScrollBar ¤ñ¸û¿Ë©M©Ê¤]¤£·|§@©Ç¡AÁöµM¨S¦³ BackColor & ForeColor¡C
Anyway ÁÙ¬O­n¦V±z»¡ÁnÁÂÁÂÅo¡I

TOP

¥»©«³Ì«á¥Ñ alexliou ©ó 2012-5-22 21:34 ½s¿è

¦^´_ 17# c_c_lai

§é½u¹Ï¨Ã¨Sª½±µªº¿ìªk¨Ó³]©w¤£¦PªºÃC¦â
¤]´N¬O»¡  InvertIfNegative »P§é½u¹Ï¦X¥Î®É¨Ã¤£·|µo´§§@¥Î
(½u¬q¬O³s±µ¨âÂI, InvertIfNegtative ¬O°w¹ï"ÂI")

­Y­n³B²z§é½u¹Ï¦b¤£¦Pªº½d³ò(¥i¥H¬OX¶b, ¤]¥i¥H¬O¤£¦PªºY­È)Åã¥Ü¤£¦PªºÃC¦â
¤@¯ë¸Ñªk¬O§â¤@­Ó¸ê®Æ¼Æ¦C®Ú¾Ú½d³ò©î¦¨¤£¦Pªº¼Æ¦C
¨C­Ó§Ç¦C½á¤©¤£¦PªºÃC¦â

PS. ¥H¤W»¡±o«Ü²³æ ¦ýImplement°_¨Ó·|¦³·sªº°ÝÃDµo¥Í
°²³]²Ä¤@ÂIªºY­È¬O 10, ²Ä¤GÂIªºY­È¬O-5
§A·Q­n¦b0¥H¤Wªº½u¬q©M0¥H¤Uªº½u¬q§e²{¤£¦PªºÃC¦â
³o¼Ë´N±o¤H¤u´¡¤J¤@­ÓÂI0 (¤À¬ÉÂI¤S·|§Î¦¨¤@­Ó¸ê®Æ¼Æ¦C)
§A¥i¥H´Â³o­Ó¤è¦V¥h«ä¦Ò
³o¬O¤@­Ó¤£ºâ¤pªº¤uµ{
Alex

TOP

¥»©«³Ì«á¥Ñ alexliou ©ó 2012-5-22 19:39 ½s¿è

¦^´_ 17# c_c_lai
¥ý¦^µª§A¦³Ãö©óScrollBar ÃC¦âªº°ÝÃD

1. «e­±»¡¹L  ¤u§@ªí¥i¨Ï¥Îªº±±¨î¶µ¥i¤À¨âºØ:
ªí³æ±±¨î¶µ©MActiveX±±¨î¶µ
¦b¤£¨Ï¥ÎVBA¨Ó¦Û°Ê«Ø¥ßScrollBar±±¨î¶µªºª¬ªp¤U
¤]´N¬O¦b¤u§@ªíÀô¹Ò¤¤  §Ú­Ì¿ï¾Ü[¶}µo¤H­û] > [´¡¤J]®É
´N¥i¥Hµo²{ EXCEL´£¨Ñ¨âºØ¿ï¾Ü : ªí³æ±±¨î¶µ©MActiveX±±¨î¶µ
¦Ó¥Bªí³æ±±¨î¶µªºÄݩʸû¤Ö  
ActiveX±±¨î¶µªºÄÝ©Ê¿ï¾Ü¸û¦h (·íMouse ¦bActiveX±±¨î¶µ¤W®É«ö¥kÁä, §A·|µo²{¦h¤F¤@­Ó[¤º®e]¼ÐÅÒ)
³o¨âºØ±±¨î¶µ¦b¥ÎVBA «Ø¥ß®É¤Î¾Þ§@®É
¨Ï¥ÎªºCode¤]¤£¤@¼Ë
ªþ¥ó¤¤¥ÎVBA code «Ø¥ß¤F¨âºØ¤£¦PªºScrollBar±±¨î¶µ ·q½Ð°Ñ¦Ò

©ÔÅQ¨Æ¥ó²£¥Í¾¹3.zip (28.09 KB)
2. ªí³æ±±¨î¶µªºScrollBar ¨ÃµLBackColor ©M ForeColorµ¥ÄÝ©Ê
©Ò¥HµLªk§ïÅÜ¥¦ªºÃC¦â
¦pªG§A­nÅýScrollBar ¦³ÃC¦â
´N¥u¯à¨Ï¥ÎActiveX±±¨î¶µScrollBar¤F
¥¦ªºBackColorÄÝ©Ê¥i¥H½Õ¾ãBarªºÃC¦â
¥¦ªºForeClorÄÝ©Ê¥i¥H½Õ¾ãBar¨âºÝ½bÀYªºÃC¦â

3. ·í§A¥ÎVBA Code¦Û°Ê«Ø¥ßActiveX±±¨î¶µ®É
·|¹J¨ì¤@­Ó³Â·Ð   ¬O¥¦¤£¤ä´©¤¤Â_¼Ò¦¡
·|Åý§A°»¿ù«Ü¤£¤è«K
(¦ý§ÚÁÙ¬O¤ñ¸û³ßÅw¥ÎActiveX±±¨î¶µ)

4. ActiveX±±¨î¶µªº¦WºÙÁÙ¦³¤@¨ÇTrickyªº¦a¤è
(§A¥i¥H¦bVBA ªº IDE¤U §Q¥ÎHelp¬dActiveX±±¨î¶µ)
©Ò¥HºÉ¶q¦b³]­p¶¥¬q®É«Ø¸m
¦Ó¤£­n¦bµ{¦¡°õ¦æ¶¥¬q§Q¥ÎVBA Code«Ø¸m¥¦
Alex

TOP

¥»©«³Ì«á¥Ñ c_c_lai ©ó 2012-5-21 10:15 ½s¿è

¦^´_ 16# alexliou
¥Ø«e§Úªº ScrollBar ¬O¥ÑVBA°ÊºA²£¥Íªº¡A¥ç§Y·í¶i¤J(±Ò°Ê) Excelªí³æ¡A¸Ó¨t²Î§Y¦Û°Ê²£¥Í¤@ScrollBar¡A
Sheets("²Î­p¹Ïªí").ScrollBars.Add(Cells(20, 1).Left, Cells(20, 1).Top, 879, Rows(1).Height).Select
·íÂ÷¶}Excel®É¡A¤S¦Û°Ê±N¥¦§R°£±¼¡C
§Úªº´£°Ý¬O¡G
§Ú·Q¯à±N¸Ó°ÊºA²£¥ÍªºScrollBar¥[¤W­I´º©ÎªÌ¬O«e´ºÃC¦â¡A¦p¦¹¤ñ¸ûÅãµÛ¡A§_ªÌ¨Ï¥ÎªÌ·|¬Ý¤£²MScrollBar¦b­þ¸Ì¡A
¦]¬°VBA²£¥ÍªºScrollBarªºÃC¦â¬ODefault­È¡A¤£ª¾¹D¥i¤£¥i¥H³o»ò°µ¡H   ¤S¡A               
.InvertIfNegative = True
.InvertColor = RGB(255, 124, 128)                     
¥u¯àÀ³¥Î¦b¬Wª¬¹Ï¡A§Ú¦b·Q¦pªG¬O xlLine «¬ºA®É¡A·íªí¦C¼Æ­È¬°­t­È®É¡A¦³§_±N¨äÅã¥Ü¤§ÃC¦â§óÅܦ¨¾ï¬õ¦â¡A
¥¿­È®É«h¿ï¾Ü¨ä¥¦ÃC¦â¡A¤£ª¾¯à§_¬ð¯}¡H
ÁÂÁ«ü¾É¡I

TOP

¦^´_ 15# c_c_lai
§ÚªºAccess ¸ê®Æ®w¤¤©Ò¦sªº³£¬O¾ú¥v¸ê®Æ
¸ê®Æ·½¨Ã«D¨é°ÓªºDDE

¦ý¦b»Ý­n§Y®É¥æ©ö¸ê®Æªºª¬ªp¤U
¨é°ÓªºDDE¸ê®Æ·½«h¬O­Ó¤£¿ùªº¿ï¾Ü
¦Ü¤Ö¸ò¨ä¥L¤@¯ë§K¶Oªº¸ê®Æ·½(¦p¥æ©ö©Òªººô­¶¡^
¥¦ªºÃ­©w©Ê©M§Y®É©Ê¡]§ó·sÀW²v¡^³£¸û¨Î
Alex

TOP

¦^´_ 14# alexliou
§Ú·|¦A¹ê¦aºt½m¦h¦¸¥HÁA¸Ñ¥¦­Ì佊¦¹¶¡¤¬°ÊÃöÁpªº¡A ÁÂÁ±z¡I
¨Ì±z©Ò¨¥¡A±z©Ò¦³¸ê®Æ³£ª½±µ¥ÑDDE¶×¤J¨ìAcess¡A¨º½u¤W±z¥u¬Ý¨é°Óªº¹Ïªí¡A
Excel ¤Wªº²Î­p¹Ïªí¥u¬O¨Ó·í§@¾ú¥v¸ê®Æ°Ñ¦Ò¨Ì¾Ú¤F¡A ©Î¬O¨âªÌ¬ÒÀx¦s¡A¦P¨B°Ñ¦Ò¡H

TOP

¥»©«³Ì«á¥Ñ alexliou ©ó 2012-5-16 03:09 ½s¿è

¦^´_ 13# c_c_lai
¨º¨ÇªþÄݦbª«¥ó(¦pThisWorkBook, ¤u§@ªí1, .......)¤UªºÅܼƩε{§Ç
§Y¨Ï«Å§i¬°Public , ­n¥h¦s¨ú©Î©I¥s,  »Ý³z¹Lª«¥óªº¶¥¼h  
¦pThisworkbook.VariableA, ¤u§@ªí1.ScrollBarChange,.....

¦ý¦b¼Ò²Õ(Module)¤¤«Å§iªºÅܼƩε{§Ç
¦p«Å§i¬°Public, §Y¨Ï¬O¦bModule¥~¨ú¥Î©Î©I¥s
¤]¤£¥Î¥[¤W¼Ò²Õªº¦WºÙ

¹³§A«e­zªº°ÝÃD
¦pªG§âScrollBarChange µ{§Ç ©ñ¦b¼Ò²Õªí1¤¤
¨Ã§â¥¦«Å§i¬°Public (³o¸Ì¤£«Å§i¤]¦æ  ¦¹±¡§Î¬O¯S¨Ò)
¨º§A¨Ï¥Î   .OnAction = "ScrollBarChange" ¤]·|work

¤u§@ªí¤Wªº±±¨î¶µªºEvent Handler ³q±`·|©ñ¦bªþÄÝ©ó¤u§@ªíªºµ{§Ç¸Ì
¦]¬°¦P¤@Ãþ§Oªº±±¨î¶µ¥i¯à·|¦b¤£¦Pªº¤u§@ªí¤¤¥X²{
¦pªG¯à½T«O¨C­Ó±±¨î¶µºÙ³£¤£¦P¦W
Event Handlers¥þ³£©ñ¦b¼Ò²Õªí¸Ì¥ç¥i
Alex

TOP

¦^´_ 11# GBKEE
¦^´_ 12# alexliou
ÁÂÁ¨â¦ìªºÀ°¦£¡A³o¨â¤Ñ§Ú¤W¤F°ê¥~ºô¯¸¦¬´M¸ê®Æ¡A§ä¨ì¤F¤@½gÁÙ¤£¿ù¡A¦p¤U¡G
  1. Sheet1.ScrollBars.Add(624763.5, 4271616, 5095730.25, 189166.5).Select

  2. With Selection
  3.     .Value = 60
  4.     .Min = SMin
  5.     .Max = SMax
  6.     .SmallChange = 1
  7.     .LargeChange = 1
  8.     .LinkedCell = "Sheet1!$O$5"
  9.     .Display3DShading = True
  10.      
  11.     With .ShapeRange
  12.         .Left = 0
  13.         .Width = 680.32
  14.         .Top = 0
  15.         .Height = 15
  16.     End With
  17.      
  18.     .OnAction = "ScrollBarChange"
  19. End With
½Æ»s¥N½X
¦ý¬O§Ú«oÆp¶i¤F¦º­J¦P  .OnAction = "ScrollBarChange"  ¦Ñ¬O§i¶D§ÚµLªk¨Ï¥Î¦¹¥¨¶°¡A
¦Ê«ä¤£¸Ñ¤§¤U¤~¨Ó¨D´©¡Aµ²ªG¬O Alex¥S¥s§Ú¨Ï¥Î .OnAction = "¤u§@ªí1.ScrollBarChange"  ¡A
«Kªï¤b¦Ó¸Ñ¤F¡C ´N®t§O¦b¥²¶·¥[¤W "¤u§@ªí1."¦r¼Ë¤~¯à¥¿±`¹B§@¡CÁÂÁ±z­Ì¡I
¥t¥~¦A½Ð±Ð¡A¦b ThisWorkbook ¤WÀY¤w¸g«Å§i¤F Public «¬ºA¡A²z½×¤W¥¦À³ÄÝ©ó Global¡A
¬°¦ó¦b"¤u§@ªí1"¤º«oµLªk¨ú±o¸Óµ¥ÅܼƤº®e­È©O¡H

TOP

        ÀR«ä¦Û¦b : §Ú­Ì³Ì¤jªº¼Ä¤H¤£¬O§O¤H¡D¥i¯à¬O¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD