Skip i'r prif gynnwys

Sut i ehangu'r ddelwedd wrth glicio arni yn Excel?

Gan dybio eich bod wedi mewnosod rhestr o luniau mewn colofn ac wedi paru maint y lluniau â'r meintiau celloedd fel y dangosir isod y screenshot. Gan fod y llun a fewnosodwyd yn edrych yn fach, efallai y bydd angen i chi ei ehangu at rai dibenion. Bydd yr erthygl hon yn dangos dull i chi o ehangu llun wrth glicio arno yn Excel, ac adfer i'r maint gwreiddiol erbyn yr ail glic.

Ehangu'r ddelwedd wrth glicio arni gyda chod VBA


Ehangu'r ddelwedd wrth glicio arni gyda chod VBA

Gall y cod VBA canlynol eich helpu i ehangu delwedd wrth glicio arno yn Excel. Gwnewch fel a ganlyn.

1. De-gliciwch y llun y mae angen i chi ei ehangu trwy glicio arno, yna cliciwch Neilltuo Macro o'r ddewislen cyd-destun. Gweler y screenshot:

2. Yn y Neilltuo Macro blwch deialog, cliciwch y Nghastell Newydd Emlyn botwm.

3. Yn y popping up Microsoft Visual Basic ar gyfer Ceisiadau ffenestr, copïwch a gludwch y cod VBA isod rhwng y is ac Is-End codau. Gweler y screenshot:

Cod VBA: Ehangu'r ddelwedd trwy glicio arno yn Excel

Dim shp As Shape
    Dim big As Single, small As Single
    Dim shpDouH As Double, shpDouOriH As Double
    big = 3   
    small = 1 
    On Error Resume Next
    Set shp = ActiveSheet.Shapes(Application.Caller)
    With shp
        shpDouH = .Height
        .ScaleHeight 1, msoTrue, msoScaleFromTopLeft
        shpDouOriH = .Height
    
        If Round(shpDouH / shpDouOriH, 2) = big Then
            .ScaleHeight small, msoTrue, msoScaleFromTopLeft
            .ScaleWidth small, msoTrue, msoScaleFromTopLeft
            .ZOrder msoSendToBack
        Else
            .ScaleHeight big, msoTrue, msoScaleFromTopLeft
            .ScaleWidth big, msoTrue, msoScaleFromTopLeft
            .ZOrder msoBringToFront
        End If
    End With

Nodyn: Yn y cod, gallwch chi neilltuo meintiau mawr y llun yn y cod mawr = 3.

4. Yna pwyswch y Alt + Q allweddi ar yr un pryd i gau'r Microsoft Visual Basic ar gyfer Ceisiadau ffenestr.

O hyn ymlaen, wrth glicio ar y llun, bydd yn cael ei ehangu i'r maint a nodwyd gennych, a bydd ei glicio eto yn adfer i'r maint gwreiddiol fel isod sgrinluniau a ddangosir.


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 (9)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Lösung zu verpixelte Bilder
Ich hatte dasselbe Problem mit den verpixelten Bildern. Du musst in den Einstellungen etwas ändern und zwar:
Unter Datei/Optionen/Erweitert unter dem Punkt "Bildgröße und -Qualität" einen Hacken bei "Bilder nicht in Datei komprimieren" setzen. Dann zeigt es die Bilder nicht mehr verpixelt an. LG
This comment was minimized by the moderator on the site
Doesnt work
This comment was minimized by the moderator on the site
I know that a jpg loses quality each time it is saved.  That's why users are advised to save to a new filename.  This could be why people who try using this macro are ending up with blurred pictures.  A better approach would be to have two pictures - a large and small of the same photo.  The small is placed in the cell, the large in a different sheet, same file.  Then use code to show the large picture when the small picture is either clicked or hover over.  This way. neither picture gets resized and therefore should not lose quality.  I am not sure Kutools is able to do this.
This comment was minimized by the moderator on the site
The Macro works, the problem is that when you resize the the picture in the macro, if you go bellow 1, and save, the picture will lose it's quality :(
This comment was minimized by the moderator on the site
Hello, I'm trying to modify the the big (1) and small (0.1) values but the macro doesn't work properly. After some click the picture doesn't modify :(
This comment was minimized by the moderator on the site
THis is what i am looking for but it won't work with my excel 2016. I get an error message Application.caller = Error 2023
This comment was minimized by the moderator on the site
when u have inserted the code and press save the pics gets smaller and smaller... great idea but does not work i´m afraid...
This comment was minimized by the moderator on the site
This code works well
But when you open the workbook a second time, the images come out blurred
This comment was minimized by the moderator on the site
Maravilloso funciona perfecto!!!.
Hay forma que la imagen quede en el cento de la pantalla, solo es una oncesion, nada mas, la macro anda muy bien
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations