Ixesha lokufunda eliqikelelweyo: 3 imizuzu
Inkqubo elandelayo ifunda amaxabiso kwiiseli ezikuluhlu A lwephepha lomsebenzi elisebenzayo, ide idibane neseli engenanto. Amaxabiso agcinwa kuluhlu. Lo mzekelo ulula we-Excel macro ubonisa ukusetyenziswa kwezi:
Do Until
;Ubound
buildin (ebuyisela esona salathisi siphezulu soluhlu).' 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
Inkqubo igcina amaxabiso kwikholamu A yephepha lomsebenzi elisebenzayo kuluhlu, qaphela ukuba:
Do Until
ikhupha amaxabiso eseli nganye kwikholamu A yephepha lomsebenzi elisebenzayo, ungahoyi iiseli ezingenantoIf UBound(dCellValues) < iRow
” ijonga ukuba uluhlu lwe-dCellValues likhulu ngokwaneleyo ukubamba ulwazi, ukuba akunjalo, sebenzisa i-ReDim ukwandisa ubungakanani boluhlu nge-10dCellValues(iRow) = Cells(iRow, 1).Value
” Igcina iseli yangoku kuluhlu lweeSeliValuesLe Nkqutyana ilandelayo ifunda amaxabiso asuka kumhlathi A wephepha lomsebenzi elibizwa ngokuba "I-Sheet2" kwaye yenza imisebenzi ye-arithmetic kumaxabiso. Amaxabiso anesiphumo ashicilelwe kumhlathi A wephepha lomsebenzi langoku.
Le macro ibonisa:
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
Masibhale i-VBA macro elula evutha xa iseli kuluhlu oluthile lwephepha lethu lihlaziywa. Masithi ufuna ukulandelela utshintsho kwikholamu B (B4 ukuya kwi-B11) kwaye urekhode umhla kunye nexesha lotshintsho kukholomu A.
Masiqhube ngolu hlobo:
Developer
cofa kukhetho "Visual Basic
” ukuvula umhleli weVBA. 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
Gcina incwadi yokusebenza ngeemakhro ezivuliweyo (umzekelo, njengefayile ye.xlsm).
Ngoku, ngalo lonke ixesha sihlaziya iseli kwikholamu B (ukusuka kumqolo woku-1 ukuya kumqolo we-10), iseli ekwikholamu A iya kubonisa ngokuzenzekelayo umhla nexesha langoku.
Ercole Palmeri
I-Coveware nguVeeam iya kuqhubeka nokubonelela ngeenkonzo zokuphendula ngeziganeko zokuxhwilwa kwe-cyber. I-Coveware iya kubonelela nge-forensics kunye nezakhono zokulungisa…
Ugcino oluqikelelweyo luguqula icandelo le-oyile negesi, ngenkqubo entsha nesebenzayo kulawulo lwemizi-mveliso.…
I-CMA yase-UK ikhuphe isilumkiso malunga nokuziphatha kweBig Tech kwimarike yobukrelekrele bokwenziwa. Pha…
Umthetho we "Green Houses", oqulunqwe yiManyano yaseYurophu ukomeleza amandla ombane kwizakhiwo, ugqibezele inkqubo yowiso mthetho nge…