Shaxda tusmada
Excel Qalab & Amarka shaandhaynta waxa uu leeyahay xad xaddidan ilaa Xogta shaandhaynta . Laakin adiga oo isticmaalaya VBA waxa aad kala shaandhayn kartaa xogta oo aad u balaadhan sidaad rabto. Maqaalkani waxa uu ku siin doonaa 8 tusaale oo faa'iido leh si aad u isticmaasho VBA code si aad ku shaandhayso xogta gudaha excel adigoo isticmaalaya VBA codes leh sawirro muuqda.
1>Soo deji Buugga Shaqada ee Barashada >
>Waxaad ka soo dejisan kartaa qaab-dhismeedka Excel ee bilaashka ah oo aad adigu iskaa u shaqeysid
>>>>>> Xeerka VBA si aad u shaandheeso Xogta.xlsm
8 Tusaalooyinka loo Isticmaalo Koodhka VBA si loo shaandheeyo Xogta gudaha Excel
Aynu marka hore soo bandhigno xog-ururintayada oo matalaysa qaar Ardayda' Jinsiga, Xaaladda, iyo Da'da .
1. Adeegso koodhka VBA si aad u shaandhayso xogta ku salaysan shuruudaha qoraalka ee Excel > 10>
Tusaalahayaga ugu horeeya, waxaanu isticmaali doonaa VBA >ilaa Sifee kaliya >Lab ardayda ka yimid Labka tiirka xog-ururinta 2> oo ku yaal ciwaanka xaashida . >>kadib ka dooro View Code ka Menu Context . >14>>Dhakhso ka dib, VBA daaqad ayaa furmaya it-
6783
- >
- Dabadeed, yaree VBA > >
>>
>> > Koodhka kala-baxa >- >
- Halkan, waxaan sameeyay Sub habka, Filter_Data_Text() . >
- kadibna adeegsaday Range hantida si loo caddeeyo magacyadeena xaashida iyo kala duwan > > Marka xigta, waxaan isticmaalay Habka AutoFilter si aan u isticmaalo Shuruudaha dookheyga halka Field:=2 ka dhigan tahay Tiirka 2 . Iyo Shuruudaha1:=“Lab” ilaa Sifee xogta Lab. >
- >
- Intaas ka dib, ilaa > fur Saduuqa wada hadalka Macros , guji sida soo socota: Developer > Macros. >
>
>- >
- > Dooro Magaca macro sida ku xusan codes-ka . >Ugu dambayntii, kaliya tax Run .
Hadda eeg in aanu helnay 1>Xogta ardayda lab ah ka dib Sifeeya .
>
> In ka badan ka akhriso: Excel Xogta Filter Qiimaha Unug (6 Siyood oo Wanagsan)> 2. Codso Koodhka VBA si aad u shaandhayso xogta leh shuruudo badan oo ku jira hal saan
> Halkan, waxaanu u shaandhayn doonaashuruudo badan oo hal tiir ah. Laga soo bilaabo tiirka lambarka saddexaad ee xog-ururinta, waxaanu u shaandhayn doonaa Ka qalin-jabiyeyiyo Ka qalin-jabintaardayda.> Tallaabooyinka:- >
- >Raac labada tallaabo ee hore ee Tusaalaha ugu horreeya si aad u furto Daaqadda VBA . >Ka dib, ku qor kuwan soo socda codes gudaha- >
5915
- kadibna yaree VBA > >14>> > > >
- Halkan, waxaan sameeyay Sub habka, Filter_One_Column() . >
- kadibna isticmaal Range hantida si aan ugu dhawaaqno magaca xaashida iyo kala duwanaanshaha > >
- Marka xigta, waxaan isticmaalay theHabka AutoFilter si aan u isticmaalo Shuruudaha dookheyga halkaas oo Meelka:=3 macnaheedu yahay qoraalka 3 . Halkan, Shuruudaha1:=”Qalinjabinta” iyo Criteria2:=”Postgraduate” ilaa Sifee Ardayga Halka .
- >Ugu dambayntii, waxaan isticmaalay Operator:=xlOr si aan u codsado AMA sharud Filter dhawr shuruudood >
- Marka daqiiqad, raac tallaabada saddexaad laga bilaabo Tusaalaha ugu horreeya si aad u furto Macros dialog sanduuq .
- Ka dib, dooro ee cayiman Magaca Macro iyo tax Run . >
- >Raac labada tallaabo ee ugu horreeya ee tusaalaha koowaad fur VBA > >>Ka dib, ku qor kan soo socda codes gudaha - >
Jadbinta Koodhka
- >
> >
Wax yar ka dib, waxaad heli doontaa safafka la sifeeyay oo ku salaysan shuruudo badan sida sawirka hoose.
In ka badan ka akhri (4 Dariiqo Ku Haboon)
3. Codso koodhka VBA si aad u shaandhayso xogta oo leh shuruudo badan oo ku jira sariiraha kala duwan ee Excel
> Hadda waxaan shaandhayn doonaa shuruudo badan - Lab iyo Qalin jabiyay ardayda. > Tallaabooyinka: >5141
- > 12> Ka dib in yareeyo daaqada VBA . >
>
Kala-baxa Koodhka >
- Halkan, waxaan sameeyay Sub habraaca, Filter_Different_Columns() . >
- Markaa, waxaan adeegsaday oo leh weedha si aan u isticmaalo > Tiir badan . >Kadibna isticmaal Range hantida si aan u caddeeyo magaceena magaca xaashida iyo kala duwan >
- Marka xigta, waxaan adeegsaday Habka AutoFilter si aan u isticmaalo Shuruudaha dookheyga halka Goob:=2 macnaheedu yahay Tiirka 2 iyo Field:=3 macnaheedu waa Tiirka 3 . >Halkan , la doortay Shuruudaha1:=”Lab” ee Labka Tiirka iyo Shuruudaha1:=” Qalinjabin” ee Status tiirka Filter xogta laga helay tiirar kala duwan . >
- >
- Kadib raac tallaabada saddexaad ka Tusaalaha ugu horreeya si aad u furto Macros dialog box . >
- Ka dib, dooro ee cayiman Magaca Macro iyo tax Run .
>>
Waa kan wax-soo-saarka qodobbada badan.
Akhri wax dheeraad ah: Excel VBA Si loogu shaandheeyo isla Saan ka mid ah Shuruudo Badan (6 Tusaalayaal)
>> 4. Isticmaal code-ka VBA si aad u kala shaandhayso 3da shay ee ugu sarreeya Excel >
>Tusaalahan, waxaanu ku shaandhayn doonaa saddexda arday ee ugu sarreeya iyadoo loo eegayo da'dooda .Tallaabooyinka: >
>- >
- >Raac labada tallaabo ee ugu horreeya ee tusaalaha koowaad si aad u furto daaqadda VBA . >
- kadib ku qor kuwa soo socda kood ku dhex jira- >
4689
- >
- Ka dib yaree Daaqadda VBA . >
>
>Jadbinta Koodhka
- >
- Waa kan, I wuxuu sameeyay Sub nidaam, Filter_Top3_Waxyaabaha() .
- kadibna la adeegsaday Operator:=xlTop10 Items si Filter for saddexda sare xogta . >
- >
- Hadda raac tillaabada saddexaad laga bilaabo tusaalaha koowaad si aad u furto Macros dialog box .
- kadib dooro magaca Macro sida ku xusan koodka oo riix Run . >14
- > Sidee loo shaandheeyaa qiyamka gaarka ah ee Excel (8 Siyaabood oo Fudud) > 12> Ku shaandhee shuruudo badan oo Excel leh VBA (Labadaba IYO iyo AMA Noocyada Hababka) > 14>
- Marka hore, Raac labada tallaabo ee hore ee Tusaalaha koowaad si aad u furto Daaqadda VBA . >
- Dabadeed, ku qor kan soo socda codes in- >
Markaa waxaad heli doontaa wax-soo-saarka sida sawirka hoose-
>Akhri wax dheeraad ah: >Sida Loo Shaandheeyo Iyada Oo Ku saleysan Qiimaha Unugyada Isticmaalka Excel VBA (4 Hababka)
Akhrisyo La Mid ah
- > 12> Sidee Loo Koobi Karaa oo Loogu Dhaadhi Markay Shaandhaynta waxaa lagu dabaqaa Excel >
5. Isticmaal code-ka VBA si aad u shaandhayso boqolkiiba 50 ee ugu sarreeya Excel
Aan isticmaalno VBA codes si loo shaandheeyo boqolkiiba konton ugu sarreeya ardayda ku salaysan da'dooda .
> Tallaabooyinka: > >2544
- 12>Yaree Daaqadda VBA . > 14>
- Halkan, waxaan sameeyay Sub nidaam, Filter_Top50_Percent () .
- Ka dib, waxaan isticmaalay Hawl-wadeen:=xlTop10Percent ilaa Ka sifee boqolkiiba kontonka ugu sarreeya column-4 .
>
>Jadbinta Koodhka > 3> <11
- >
- Hadda, raac tallaabada saddexaad laga bilaabo tusaalaha koowaad si aad u furto Macros dialog box.
- kadib dooro ee cayiman Macro name iyo riix Run .
Waxaa jiray wadar ahaan 7 arday marka 50 boqolkiiba , waxay muujinaysaa qiyaastii saddex arday .<3
Akhri wax dheeraad ah: > Sida loo Isticmaalo Foomamka Boqolleyda Faa'iidada ee Excel (3 Tusaalayaal)
>> 6 . Codso koodhka VBA si aad u shaandhayso xogta Isticmaalka Wildcard >
Waxaan u isticmaali karnaa Xarfaha kaarka duurka -* (asterisk) gudaha codes VBA si aan u shaandheeyo xogta gudaha Excel. Laga soo bilaabo Tiirka Xaaladda , waxaanu ka shaandheyn doonaa kaliya qiimaha ka kooban 'Post' .
>> Tallaabooyinka: >
- Raac labada tallaabo ee hore ee Tusaalaha ugu horreeya si aad u furto Daaqadda VBA .
- kaddib qor kuwan soo socda codes gudaha - >
6543
- Ka dib, yaree daaqada VBA . > 14>
>
> >Koodhka kala-baxa
- Halkan, waxaan sameeyay Sub habraaca, Ku-sifee_kaarka duurka () . >
- kadibna la isticmaalay Range >(“B4”) si loo dejiyo xadka >kuxiga , waa la isticmaalay AutoFilter to Sifee gudaha Goobta:=3 macneheedu waa tiirka 3. > >>> Shuruudaha1:=”* Ku dhaji *” ilaa Sifee qiyamka ka kooban 'Post'.
- >
- Hadda raac tallaabada saddexaad laga bilaabo marka hore tusaale si loo furo Macros dialogsanduuqa. >
- > Dooro ee cayiman Magaca Macro iyo taabo Run . > 14>>
- kadib dhagsii Geli > Module ilaa fur module . >
- Hadda qor kan soo socda –
>
Markaa waxaad heli doontaa wax-soo-saarka la rabo.
>
Wax badan ka sii akhri: > Sida loogu daro Filter in Excel (4 Hababka )
7. Ku dheji Excel VBA si aad ugu koobbiso xogta la sifeeyay xaashi cusub ee Excel
Arag inay jiraan xog la sifeeyay oo ku jirta xogtayda. Hadda waxaan ku koobi doonaa xaashi cusub anigoo isticmaalaya VBA . Koodhadhkani si sax ah ugu shaqayn maayaan xaashida, waa inaad ku dabaqdaa qaybta 1>Riix Alt+F11 si aad u furto VBA >14>> >
- >
>
- >
7487
- >12>ka bacdi yaree VBA > >
> >>
>> 0 Koodhka kala-baxa- >
- Halkan, waxaan sameeyay Sub habka, Koobi_Filtered_Data_NewSheet() .
- Intaa ka dib lagu dhawaaqay laba-doorsoomi- x Rng Sida Range iyo xWS Sida Xaashida shaqada Hubi La sifeeyay > >
- Dabadeed, la isticmaalay MsgBox si loo muujiyo soo-saarka .Range si aad u doorato Filtered kala duwan oo loo isticmaalo ku dar si loogu daro xaashi cusub. >Ugu dambayn, Koobi Range(“G4”) waxay koobi doontaa xogta Filtered xaashida cusub tilaabada saddexaad laga bilaabo Tusaalaha koowaad si aad u furto Macros dialog box .
- Kaddib dooro ee Magaca Macro-ga la cayimay. 2>iyo riix Run . >
>Tallaabooyinka: >
11>>Dooro Liis ka Oggolow hoos-u-dhaca .
Ka dib guji summada furan ka sanduuqa isha .
0> >Hadda dooro cabbirrada kala duwan iyo ku dhufo badhanka Gelida .
> >> >- 12>Waqtigan xaadirka ah, kaliya taabo OK . >
Hadda liiskayaga hoos-u-dhac waa diyaar.
>
>- > Hadda Raac labada tallaabo ee hore ee Tusaalaha ugu horreeya si aad u furto Daaqadda VBA
- ka bacdi qor kan soo socda kood ku dhex jira- >
8152
- >
- kadib yaray VBA-dadaaqada .
Code Breakdown
- Halkan, anigaa abuuray a Habka gaarka , Shaqada_Beddelka (ByVal Target As Range). > >
- Markaa, waxaan ka doortay Xaashida shaqada ka Guud iyo Ka beddel ka Bayaannada .
- > Kadib dhig Cinwaanka si aad u ogaato meesha. >Ugu dambayntii gudaha HADDII ay isticmaasho AutoFilter habka Field >iyo Shuruudaha >
- >
- Hadda kaliya ka dooro shuruudaha liiska hoos-u-dhaca iyo Filterka waa la hawlgelin doonaa .
Waa kan Lagu sifeeyay ka dib marka la doorto Lab ka hoos-u-dhac .
Akhri wax badan 1>Qaybta Tababarka > > Waxaad heli doontaa xaashi shaqo oo ku jirta faylka Excel ee kor lagu sheegay si aad ugu dhaqanto siyaabaha la sharaxay.
> > > >Waxaan rajaynayaa in hababka kor lagu sharaxay ay ku fiicnaan doonaan in la isticmaalo VBA kood si Filter xogta ku jirta excel. Xor baad u tahay inaad su'aal kasta ku waydiiso qaybta faallooyinka oo fadlan faallo celin i sii. >