Yuav Tsim Cov Program Hauv Excel Li Cas

Cov txheej txheem:

Yuav Tsim Cov Program Hauv Excel Li Cas
Yuav Tsim Cov Program Hauv Excel Li Cas

Video: Yuav Tsim Cov Program Hauv Excel Li Cas

Video: Yuav Tsim Cov Program Hauv Excel Li Cas
Video: Qhia kaw cov chav tseem ceeb hauv Excel 27 Sep 2017 2024, Hlis ntuj nqeg
Anonim

Txhua Microsoft Chaw Haujlwm cov ntawv thov txhawb nqa lub peev xwm los tsim cov cai - sau ntawv - rau hauv lawv cov ntaub ntawv. Nrog lawv cov kev pab, koj tuaj yeem daws ntau cov haujlwm nyob hauv qhov automation ntawm kev ua cov ntaub ntawv. Thiab kev siv cov foos yuav tsim tau cov phiaj xwm raws li kev thov ntawm chaw haujlwm. Qhov no tuaj yeem ua tiav, piv txwv, hauv Excel.

Yuav tsim cov program hauv Excel li cas
Yuav tsim cov program hauv Excel li cas

Tsim nyog

Microsoft Office Excel

Cov Lus Qhia

Kauj ruam 1

Pib Microsoft Office Excel. Tsim daim ntawv tshiab yog tsim nyog. Txhawm rau ua qhov no, nias Ctrl + N lossis nthuav cov ntawv "Cov Ntaub Ntawv" thiab xaiv cov khoom "Tshiab …". Tom qab ntawv nyem rau ntawm "Blank Book" txuas rau hauv "Tsim Phau Ntawv" vaj huam sib luag.

Kauj ruam 2

Qhib Visual Basic Editor window. Txhawm rau ua qhov no, nias Alt + F11 lossis xaiv Visual Basic Editor los ntawm Macro seem ntawm Cov Cuab yeej Qhia Ntawv. Nyob ntawd koj yuav pom cov phiaj xwm phiaj xwm nthuav tawm cov khoom ntoo ntawm phau ntawv Excel ua haujlwm no, nrog rau cov ntawv, ua qauv, thiab chav kawm uas nws muaj.

Kauj ruam 3

Tsim cov ntawv yog tias xav tau. Hauv cov ntawv qhia zaub mov tseem ceeb, nyem rau ntawm Insert thiab ces UserForm. Ib yam khoom tshiab tau ntxiv nyob rau hauv Cov Ntawv Thaj Chaw ntawm cov phiaj xwm phiaj xwm. Thaum tsim tau, daim ntawv yuav cia li qhib. Siv tus nas rau luag tswj los ntawm Toolbox mus rau daim ntawv qhib. Hloov lawv qhov loj me thiab txoj haujlwm. Tom qab xaiv nrog tus nas, hloov pauv lawv cov khoom hauv Properties vaj huam sib luag. Txuag cov duab los ntawm nias Ctrl + S.

Kauj ruam 4

Tsim kom muaj ntau tus qauv lossis qauv chav kawm raws li xav tau. Ua li no, xaiv cov Module lossis Class Module cov khoom hauv Seem ntu ntawm cov ntawv qhia zaub mov tseem ceeb. Qhib cov cai kho qhov rai rau cov qauv uas xav tau lossis cov foos los ntawm ob-nias ntawm cov khoom sib xws hauv lub qhov rai ua haujlwm.

Kauj ruam 5

Ntxiv cov lus tshaj tawm hauv chav kawm rau cov chav kawm ua qauv. Txhais lawv los ntawm Kev Siv Chav Kawm Lub Cim:

Chav Kawm Ntawv CSampleClass

Xaus Chav Kawm

Kauj Ruam 6

Ntxiv cov hau kev rau cov lus txhais hauv chav kawm, thiab kev ua haujlwm thiab cov txheej txheem tshev rau cov qauv. Cov haujlwm yog tshaj tawm siv Kev Ua Haujlwm lo lus tseem ceeb, tom qab los ntawm ib lub npe thiab txheej txheej, cais los ntawm kab sau, hauv kab lus pom. Piv txwv li:

Cov Qauv Haujlwm SampleFunction (a, b, c)

Tus Kawg Tas

Zoo sib xws (tsuas yog siv cov ntsiab lus Sub) cov txheej txheem raug tshaj tawm:

Sub Qauv Piv (a, b)

Xaus Sub

Kauj Ruam 7

Tshaj tawm cov tub kawm ua qhov tseem ceeb, nrog rau thoob ntiaj teb thiab hauv zos (hauv cov haujlwm thiab cov qauv) hloov pauv. Txhawm rau ua qhov no, siv Dim … Raws li kab lus (hom kev hloov pauv tau qhia tom qab As keyword). Piv txwv li, tshaj tawm ib qho sib txawv ntawm oWB uas khaws cov lus qhia rau phau ntawv khoom yuav zoo li no:

Dim oWB Raws li Excel. Workbook

Los ntawm kev txheeb xyuas qhov pom qhov loj me hauv kab npoo, koj tuaj yeem tshaj tawm ib qho kev ntsuas:

Dim aWBooks (10) Raws li Excel. Workbook

Kauj ruam 8

Ua cov txheej txheem ntawm lub cajmeem los ntawm kev hloov pauv ntawm cov cai ntawm cov haujlwm, cov txheej txheem, hom kev kawm. Siv Visual Basic tswj kev teeb tsa los tswj kev khiav ntawm kev ua. Ua haujlwm nrog koj tus kheej cov ntaub ntawv qauv, cov hauv-hauv daim ntawv cov khoom siv thiab cov cuab yeej hauv Excel.

Pom zoo: