Shaxda tusmada
In a VBA code, the UsedRange hantida waa in lala isticmaalo magaca xaashida shaqada. Markaa macnaha guud ee isticmaalka UsedRange hantida xaashida shaqada ee firfircoon waa:
>> Dim Rng As Range
>
Set Rng = ActiveSheet.UsedRange
>
⧭ > Qoraallada waa magaca Range oo uu soo celiyay hantida UsedRange . Waxaad isticmaali kartaa wax kasta oo aad jeceshahay
Tusaale ahaan, si aad ugu codsato xaashida shaqada ee loo yaqaan Sheet1 , geli:
Set Rng = Worksheets("Sheet1").UsedRange
>> >
> 4 Siyaabaha Si aad u isticmaasho Hantida loo isticmaalo ee VBA gudaha Excel 5>
Waa kuwan 4 kuwa ugu caansansiyaabaha loo isticmaalo UsedRange hantida gudaha VBA .
>>1>1. VBA UsedRange Property ee Range Xidhan >
> Marka hore, waxaanu u isticmaali doonaa VBA UsedRange hantida xaashida shaqada oo leh kala duwanaansho xidhan. >Waa Waxaan soo celin doonaa dhammaan safafka oo ay ku jiraan saf madhan bilowga.>Halkan waxaan ku haynaa warqad shaqo oo la yiraahdo Sheet1oo ka kooban tiro xiran oo ka kooban magacyada, taariikhda ku biirista, iyo mushaharka qaar ka mid ah shaqaalaha shirkadda>>> Hadda haddii aad isticmaasho UsedRangehantida xaashidan shaqada, waxay soo celinaysaa tirada B2:C13(oo ay ku jirto saf madhan bilowgii) Set Rng = ActiveSheet.UsedRange
>
1> Dim Rng As Range
> : >
Waxaan isticmaalnay Dooro hantida Range ee ku dhex jirta koodka. Marka, haddii aan socodsiino koodka, waxay dooran doontaa xadka B2:D13 ee Sheet1 .
> >>> Wax badan ka sii akhri: >>Sida loo Isticmaalo Shayga Kala Duwan ee VBA ee Excel (5 Properties) >>> 13>> 2. VBA UsedRange Property ee Range Kala firdhisan > > Haddii aad leedahay kala firdhisan xaashi kasta oo shaqo, UsedRange hantida ayaa soo celin doonta tiro ay ku jiraan unugyada madhan ee u dhexeeya.
0>Hadda, gudaha Sheet1, waxaanu ku haynaa wadarta mushaharka, mushaharka ugu sarreeya, iyo mushaharka ugu hooseeya oo ku kala firirsan meelo kala duwan, laga bilaabo unugga B3ilaa G3, sidan oo kale:>>> Hadda isticmaal mid ka mid ah labada sadar ee kood si aad u isticmaasho UsedRangehantida. Dim Rng As Range
Set Rng = ActiveSheet.UsedRange
Ama
Dim Rng As Range
Set Rng = Worksheets("Sheet1").UsedRange
> 3>
> saf maran bilowgii). Sida aan u isticmaalnay Dooro hantida Range , waxay dooran doontaa inta u dhaxaysa B2:G3. >Dooro
> 20>
Akhri wax dheeraad ah: >Dhammaadka Xadka Isticmaalka VBA ee Excel 2>
- Excel VBA Nuqulka Range ilaa xaashi kale (8 siyood oo ugu Fudud) >
- Kalab Range unug kasta oo leh Excel VBA (Ultimate) Hagaha) > >
- > Cilmi-ku-qoris Excel ka baxsan VBA-da (oo leh 5 Xal)
Haddii aan rabno in aan ku shaqayno La isticmaaloRange hantida ku taal xaashida shaqo ee aan firfircoonayn, waa in aad sheegtaa magaca xaashida shaqada bilowga.<3
Tusaale ahaan, halkan xaashida shaqada ee firfircooni waa Sheet1 .
>Si aan u isticmaalno La isticmaaloRange hantida gudaha Sheet2 , waa inaan isticmaalnaa : > Dim Rng As Range
Set Rng = Worksheets("Sheet2").UsedRange
>
Waa Waxaan dooran doonaa dhammaan unugyada la isticmaalay xaashida shaqada ee loo yaqaan Sheet2 .
In ka badan ka akhriso: VBA si loo dejiyo Range gudaha Excel (7 Tusaalayaal)
4.VBA UsedRange Property ee Buug-hawleed Aan Firfircoonayn
Xitaa waxaad isticmaali kartaa hantida UsedRange buug-shaqeedka aan firfircoonayn. Kaliya hor dhig magaca buugga shaqada.
Tusaale ahaan, halkan buug-hawleedkayga firfircooni waa Buugga shaqada1 . Si aan u isticmaalno UsedRange hantida ka badan Sheet1 ee Buug-shaqeedka2 , waa inaan isticmaalnaa:
> Dim Rng As Range
Set Rng = Workbooks("Workbook2.xlsm").Worksheets("Sheet1").UsedRange
>
Ka sii akhri: VBA unug kasta oo ku jira Range gudaha Excel
Waxyaabaha la Xasuusto >
> La isticmaaloRange hantida VBA waxay soo celisaa Range shay. Halkan maqaalkan, waxaanu u isticmaalnay Dooro hantida Waxyaabaha kala duwan si loo eego aragtida. Laakiin sida iska cad, waxaad isticmaali kartaa hanti kasta oo kale oo ah Range iyadoo loo eegayo habboonaantaada.> Gabagabo
Isticmaalka hababkan, waxaad isticmaali kartaa UsedRange hanti ku taal Excel. Wax su'aalo ah ma qabtaa? Xor baad u tahay inaad na waydiiso.