Dab tsi yog qhov dim thiab teeb tsa hauv VBA?
Dab tsi yog qhov dim thiab teeb tsa hauv VBA?

Video: Dab tsi yog qhov dim thiab teeb tsa hauv VBA?

Video: Dab tsi yog qhov dim thiab teeb tsa hauv VBA?
Video: Tshuaj theem vim li cas thiaj tau nqi ?/ Siv kho mob dab tsi?/paris polyphylla use for? 2024, Kaum ib hlis
Anonim

Dim : koj tab tom txhais qhov sib txawv (ntawm no: r yog qhov sib txawv ntawm hom Range) Teeb : koj tab tom teeb tsa cov cuab yeej (ntawm no: teeb tus nqi ntawm r rau Range ("A1") - qhov no tsis yog hom, tab sis tus nqi). Koj yuav tsum siv teeb nrog cov khoom, yog r yog hom yooj yim (piv txwv li int, hlua), ces koj tsuas yog sau: Dim r As Integer r = 5.

Ib sab ntawm no, dab tsi yog qhov ntev ntev hauv VBA?

A ntev integer yog tus lej uas tuaj yeem siv rau qhov sib txawv uas muaj cov lej ntau dua li cov lej. Txhawm rau tshaj tawm qhov sib txawv uas yuav tuav tau ntau tus lej, siv lub Ntev hom ntaub ntawv. Nov yog ib qho piv txwv: Sub Exercise() Dim Population As Ntev End Sub. Hom cim rau lub Ntev hom ntaub ntawv yog @.

Ib yam li ntawd, vim li cas DIM siv hauv VBA? Cov Dim lo lus tseem ceeb yog luv rau Dimension. Nws yog siv tshaj tawm variables nyob rau hauv VBA . Tshaj tawm txhais tau tias peb tab tom qhia VBA hais txog qhov sib txawv peb yuav siv tom qab ntawd.

Ib yam li ntawd, kuv yuav siv dim hauv VBA li cas?

Thaum koj tshaj tawm cov hloov pauv los ntawm kev siv a Dim nqe lus ( Dim yog luv luv rau dimension): rau tshaj tawm qhov sib txawv los tuav tus Integer tus nqi , siv " Dim rowNumber As Integer"; rau kev tshaj tawm qhov sib txawv los tuav cov ntawv tseem ceeb, siv " Dim strEmployeeName As String"; thiab lwm yam.

Koj teeb tsa qhov khoom sib txawv hauv VBA li cas?

Thaum peb tshaj tawm a sib txawv peb yuav tsum muab hom ntaub ntawv rau nws thiab peb kuj tuaj yeem muab khoom raws li cov ntaub ntawv hom. Txhawm rau muab tus nqi rau kev tshaj tawm khoom variables peb yuav tsum siv lo lus " SET ”. Lo lus " Teeb ” siv los xa mus rau ib qho tshiab khoom hauv VBA , piv txwv li, xa mus rau qhov tshwj xeeb ntawm cov ntawv ua haujlwm tshwj xeeb.

Pom zoo: