ခန့်မှန်းခြေ စာဖတ်ချိန်- 3 minuti
အောက်ဖော်ပြပါ လုပ်ငန်းစဉ်ခွဲများသည် အလုပ်စာရွက်၏ကော်လံ A ရှိ ဆဲလ်များမှ တန်ဖိုးများကို ၎င်းသည် ကွက်လပ်တစ်ခုနှင့် မတွေ့မချင်း၊ တန်ဖိုးများကို array တစ်ခုတွင် သိမ်းဆည်းထားသည်။ ဤရိုးရှင်းသော Excel မက်ခရိုနမူနာသည် အသုံးပြုမှုကို ဖော်ပြသည်-
Do Until
;Ubound
builtin ( array တစ်ခု၏အမြင့်ဆုံးအညွှန်းကိုပြန်ပေးသည် ) ။' Sub procedure store values in Column A of the active Worksheet
' into an array
Sub GetCellValues()
Dim iRow As Integer ' stores the current row number
Dim dCellValues() As Double ' array to store the cell values
iRow = 1
ReDim dCellValues(1 To 10)
' Do Until loop to extract the value of each cell in column A
' of the active Worksheet, as long as the cell is not blank
Do Until IsEmpty(Cells(iRow, 1))
' Check that the dCellValues array is big enough
' If not, use ReDim to increase the size of the array by 10
If UBound(dCellValues) < iRow Then
ReDim Preserve dCellValues(1 To iRow + 9)
End If
' Store the current cell in the CellValues array
dCellValues(iRow) = Cells(iRow, 1).Value
iRow = iRow + 1
Loop
End Sub
လုပ်ထုံးလုပ်နည်းသည် ကော်လံ A တွင် အသက်ဝင်နေသော အလုပ်စာရွက်၏ တန်ဖိုးများကို array တစ်ခုတွင် သိမ်းဆည်းသည်၊ သတိပြုပါ။
Do Until
လုပ်ဆောင်နေသော အလုပ်စာရွက်၏ ကော်လံ A ရှိ ဆဲလ်တစ်ခုစီ၏ တန်ဖိုးများကို ထုတ်ယူပြီး၊ ဆဲလ်အလွတ်များကို လျစ်လျူရှုခြင်း၊If UBound(dCellValues) < iRow
” dCellValues array သည် အချက်အလက်များကို ထိန်းထားနိုင်လောက်အောင် ကြီးမားကြောင်း စစ်ဆေးသည်၊ မဟုတ်ပါက၊ array ၏အရွယ်အစားကို 10 ဖြင့်တိုးရန် ReDim ကိုအသုံးပြုပါ။dCellValues(iRow) = Cells(iRow, 1).Value
” လက်ရှိဆဲလ်ကို CellValues ခင်းကျင်းတွင် သိမ်းဆည်းသည်။အောက်ဖော်ပြပါ လုပ်ငန်းစဉ်ခွဲများသည် “Sheet2” ဟု အမည်ပေးထားသည့် အလုပ်စာရွက်ကော်လံ A မှ တန်ဖိုးများကို ဖတ်ပြီး တန်ဖိုးများပေါ်တွင် ဂဏန်းသင်္ချာလုပ်ဆောင်မှုများကို လုပ်ဆောင်သည်။ ရရှိလာသောတန်ဖိုးများကို လက်ရှိအသုံးပြုနေသော အလုပ်စာရွက်၏ကော်လံ A တွင် ရိုက်နှိပ်ထားသည်။
ဤ macro သည်-
Do Until
;' Sub procedure to loop through the values in Column A of the Worksheet
' "Sheet2", perform arithmetic operations on each value, and write the
' result into Column A of the current Active Worksheet ("Sheet1")
Sub Transfer_ColA()
Dim i As Integer
Dim Col As Range
Dim dVal As Double
' Set the variable 'Col' to be Column A of Sheet 2
Set Col = Sheets("Sheet2").Columns("A")
i = 1
' Loop through each cell of the column 'Col' until
' a blank cell is encountered
Do Until IsEmpty(Col.Cells(i))
' Apply arithmetic operations to the value of the current cell
dVal = Col.Cells(i).Value * 2 + 1
' The command below copies the result into Column A
' of the current Active Worksheet - no need to specify
' the Worksheet name as it is the active Worksheet.
Cells(i, 1) = dVal
i = i + 1
Loop
End Sub
ကျွန်ုပ်တို့၏စာရွက်၏ သီးခြားအကွာအဝေးတစ်ခုရှိ ဆဲလ်တစ်ခုကို အပ်ဒိတ်လုပ်သည့်အခါ ရိုးရှင်းသော VBA macro တစ်ခုကို ရေးကြပါစို့။ ကော်လံ B (B4 မှ B11) တွင် အပြောင်းအလဲများကို ခြေရာခံပြီး ကော်လံ A တွင် အပြောင်းအလဲ၏ ရက်စွဲနှင့် အချိန်ကို မှတ်တမ်းတင်လိုသည်ဆိုပါစို့။
ဤကဲ့သို့ ဆက်လုပ်ကြပါစို့။
Developer
option ကိုနှိပ်ပါ"Visual Basic
"VBA တည်းဖြတ်သူကိုဖွင့်ရန်။ Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("B1:B10")) Is Nothing Then
Target.Range("A1:A1").Value = Now
End If
End Sub
မက်ခရိုဖွင့်ထားခြင်းဖြင့် အလုပ်စာအုပ်ကို သိမ်းဆည်းပါ (ဥပမာ၊ .xlsm ဖိုင်တစ်ခုအနေဖြင့်)။
ယခု၊ ကျွန်ုပ်တို့သည် ကော်လံ B (အတန်း 1 မှ အတန်း 10 အထိ) တွင် ဆဲလ်တစ်ခုကို အပ်ဒိတ်လုပ်တိုင်း၊ ကော်လံ A ရှိ ဆဲလ်သည် လက်ရှိ ရက်စွဲနှင့် အချိန်ကို အလိုအလျောက် ပြသမည်ဖြစ်သည်။
Ercole Palmeri
Veeam မှ Coveware သည် ဆိုက်ဘာငွေညှစ်မှု ဖြစ်ရပ်ကို တုံ့ပြန်သည့် ဝန်ဆောင်မှုများကို ဆက်လက်ပံ့ပိုးပေးပါမည်။ Coveware သည် မှုခင်းဆေးပညာနှင့် ပြန်လည်ပြင်ဆင်ခြင်းစွမ်းရည်များကို ပေးဆောင်လိမ့်မည်...
ကြိုတင်ပြင်ဆင်ထိန်းသိမ်းမှုသည် စက်ရုံစီမံခန့်ခွဲမှုအတွက် ဆန်းသစ်ပြီး အပြုသဘောဆောင်သောချဉ်းကပ်မှုဖြင့် ရေနံနှင့် သဘာဝဓာတ်ငွေ့ကဏ္ဍကို တော်လှန်နေပါသည်။…
UK CMA သည် ဥာဏ်ရည်တုစျေးကွက်တွင် Big Tech ၏အပြုအမူနှင့် ပတ်သက်၍ သတိပေးချက်ထုတ်ပြန်ခဲ့သည်။ ဟိုမှာ…
အဆောက်အဦများ၏ စွမ်းအင်ထိရောက်မှုကို မြှင့်တင်ရန် ဥရောပသမဂ္ဂမှ ရေးဆွဲခဲ့သော "Case Green" အမိန့်သည် ၎င်း၏ ဥပဒေပြုရေးလုပ်ငန်းစဉ်ကို နိဂုံးချုပ်လိုက်သည်...