Skip i'r prif gynnwys

Sut i arnofio Botwm Gorchymyn bob amser ar daflen waith yn Excel?

Mewn rhai achosion, efallai y bydd angen Botwm Gorchymyn arnofio (Rheolaethau ActiveX) arnoch i ddal i symud gyda'ch taflen waith ni waeth sut rydych chi'n sgrolio i fyny neu i lawr y daflen waith. Bydd yr erthygl hon yn dangos dull i chi ei gyflawni.

Bob amser yn arnofio Botwm Gorchymyn ar daflen waith gyda chod VBA


Bob amser yn arnofio Botwm Gorchymyn ar daflen waith gyda chod VBA

Gwnewch fel a ganlyn i wneud Botwm Gorchymyn bob amser yn arnofio yn y daflen waith.

1. Yn y daflen waith sy'n cynnwys Botwm Gorchymyn Rheoli ActiveX rydych chi am iddo fod yn arnofio, cliciwch ar y dde ar y tab dalen, ac yna cliciwch Gweld y Cod o'r ddewislen cyd-destun.

2. Yn y popping up Microsoft Visual Basic ar gyfer Ceisiadau ffenestr, copïo a gludo'r cod VBA isod i mewn i ffenestr y Cod.

Cod VBA: Gwnewch Botwm Gorchymyn bob amser yn arnofio yn y daflen waith

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
        On Error GoTo 0
        With Cells(Windows(1).ScrollRow, Windows(1).ScrollColumn)
            CommandButton1.Top = .Top + 100
            CommandButton1.Left = .Left + 300
        End With
End Sub

Nodyn: yn y cod abovde, CommandButton1 yw'r enw botwm rydych chi am ei gadw'n weladwy bob amser. Newidiwch ef i'ch angen.

3. Yna pwyswch y Alt + Q allweddi i adael y Microsoft Visual Basic ar gyfer Ceisiadau ffenestr.

O hyn ymlaen, bydd y Botwm Gorchymyn bob amser yn arnofio yng nghanol uchaf y daflen waith gyda symud cell wedi'i chlicio'n weithredol fel y dangosir isod y llun.

Nodyn: Mae'r VBA hwn yn gweithio ar gyfer y Botymau Gorchymyn Controld ActiveX yn unig.


Erthyglau perthnasol:

Offer Cynhyrchiant Swyddfa Gorau

🤖 Kutools AI Aide: Chwyldro dadansoddi data yn seiliedig ar: Cyflawniad Deallus   |  Cynhyrchu Cod  |  Creu Fformiwlâu Personol  |  Dadansoddi Data a Chynhyrchu Siartiau  |  Invoke Swyddogaethau Kutools...
Nodweddion Poblogaidd: Darganfod, Amlygu neu Adnabod Dyblygiadau   |  Dileu Rhesi Gwag   |  Cyfuno Colofnau neu Gelloedd heb Colli Data   |   Rownd heb Fformiwla ...
Super-edrych: VLookup Meini Prawf Lluosog    VLookup Gwerth Lluosog  |   VLookup Ar Draws Taflenni Lluosog   |   Edrych Niwlog ....
Rhestr gwympo Uwch: Creu Rhestr Gollwng yn Gyflym   |  Rhestr Gollwng Dibynnol   |  Rhestr Gollwng Aml-ddewis ....
Rheolwr Colofn: Ychwanegu Nifer Penodol o Golofnau  |  Symud Colofnau  |  Toglo Statws Gwelededd Colofnau Cudd  |  Cymharwch Ystodau a Cholofnau ...
Nodweddion dan Sylw: Ffocws ar y Grid   |  Golwg Dylunio   |   Bar Fformiwla Mawr    Rheolwr Llyfr Gwaith a Thaflen   |  Llyfrgell Adnoddau (Testun Auto)   |  Dewiswr Dyddiad   |  Cyfuno Taflenni Gwaith   |  Amgryptio/Dadgryptio Celloedd    Anfon E-byst trwy Restr   |  Hidlo Super   |   Hidlo Arbennig (hidlo mewn print trwm/italig/strikethrough...) ...
15 Set Offer Gorau12 Testun offer (Ychwanegu Testun, Dileu Cymeriadau,...)   |   50 + Siart Mathau (Siart Gantt,...)   |   40+ Ymarferol Fformiwlâu (Cyfrifwch oedran yn seiliedig ar ben-blwydd,...)   |   19 mewnosod offer (Mewnosod Cod QR, Mewnosod Llun o'r Llwybr,...)   |   12 Trosi offer (Rhifau i Eiriau, Trosi arian cyfred,...)   |   7 Uno a Hollti offer (Rhesi Cyfuno Uwch, Celloedd Hollt,...)   |   ... a mwy

Supercharge Eich Sgiliau Excel gyda Kutools ar gyfer Excel, a Phrofiad Effeithlonrwydd Fel Erioed Erioed. Kutools ar gyfer Excel Yn Cynnig Dros 300 o Nodweddion Uwch i Hybu Cynhyrchiant ac Arbed Amser.  Cliciwch Yma i Gael Y Nodwedd Sydd Ei Angen Y Mwyaf...

Disgrifiad


Mae Office Tab yn dod â rhyngwyneb Tabbed i Office, ac yn Gwneud Eich Gwaith yn Haws o lawer

  • Galluogi golygu a darllen tabbed yn Word, Excel, PowerPoint, Cyhoeddwr, Mynediad, Visio a Phrosiect.
  • Agor a chreu dogfennau lluosog mewn tabiau newydd o'r un ffenestr, yn hytrach nag mewn ffenestri newydd.
  • Yn cynyddu eich cynhyrchiant 50%, ac yn lleihau cannoedd o gliciau llygoden i chi bob dydd!
Comments (15)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
it works fine in one workbook, now i tried to do the same thing in another workbook and i got a compiling error because of the selectionchange. i'm pretty new in vba - maybe it's because i already got a private sub worksheet_selectionchange? do you know how i can fix this? 
This comment was minimized by the moderator on the site
I think it should specify that the button has to be an ActiveX one to the code work. ^.^'
This comment was minimized by the moderator on the site
Hi,
Thank you for your reminder.
This comment was minimized by the moderator on the site
I think it should specify that the button has to be an ActiveX one to the code work. ^.^'
This comment was minimized by the moderator on the site
Does not work :-(
This comment was minimized by the moderator on the site
Hi,
When you scrolling down the worksheet, please click to change the active cell to the visible area to make it work. Thank you for your comment.
This comment was minimized by the moderator on the site
see it, not working, i'm scrolling down and also command button down, i want to fix on the top of right side of sheet.
This comment was minimized by the moderator on the site
Hi,
When you scrolling down the worksheet, please click to change the active cell to the visible area to make it work. Thank you for your comment.
This comment was minimized by the moderator on the site
not working
This comment was minimized by the moderator on the site
Thanks a lot ... It worked...
This comment was minimized by the moderator on the site
Works fine for me. Thx
This comment was minimized by the moderator on the site
Thanks its good with cellselecting
This comment was minimized by the moderator on the site
Not good QA - check your name on the button. If this is what gets published for the Web community to see, what goes in behind the scenes with the code? :-)
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations