Manaʻo manawa heluhelu: 3 minuke
Heluhelu ke kaʻina hana ma lalo nei i nā waiwai mai nā cell i ke kolamu A o ka pepa hana hana, a hiki i ka wā e hālāwai ai me kahi cell blank. Mālama ʻia nā waiwai i loko o kahi array. Hōʻike kēia hiʻohiʻona macro Excel maʻalahi i ka hoʻohana ʻana o:
Do Until
;Ubound
builtin (ʻo ia ka mea e hoʻihoʻi i ka helu kiʻekiʻe o kahi 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
Mālama ke kaʻina hana i nā koina ma ke kolamu A o ka pepa hana i loko o kahi ʻano, e hoʻomaopopo i kēia:
Do Until
unuhi i nā waiwai o kēlā me kēia cell i ke kolamu A o ka pepa hana hana, me ka nānā ʻole ʻana i nā cell blankIf UBound(dCellValues) < iRow
" e nānā i ka nui o ka dCellValues array e paʻa i ka ʻike, inā ʻaʻole, e hoʻohana iā ReDim e hoʻonui i ka nui o ka array e 10dCellValues(iRow) = Cells(iRow, 1).Value
” Mālama i ke kelepona o kēia manawa i ka pūʻulu CellValuesHeluhelu ke kaʻina hana ma lalo nei i nā waiwai mai ka kolamu A o ka pepa haʻawina i kapa ʻia ʻo "Sheet2" a hana i nā hana helu ma nā waiwai. Paʻi ʻia nā waiwai i loaʻa ma ka kolamu A o ka pepa hana hana o kēia manawa.
Hōʻike kēia 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
E kākau mākou i kahi macro VBA maʻalahi e ʻā ana i ka wā e hōʻano hou ʻia kahi kelepona ma kahi kikoʻī o kā mākou pepa. Inā makemake ʻoe e hahai i nā loli ma ke kolamu B (B4 a i ka B11) a e hoʻopaʻa i ka lā a me ka manawa o ka hoʻololi ʻana ma ke kolamu A.
E hoomau kakou penei:
Developer
kaomi ma ke koho "Visual Basic
” e wehe i ka mea hoʻoponopono 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
E mālama i ka puke hana me nā macros i hoʻohana ʻia (no ka laʻana, he faila .xlsm).
I kēia manawa, i kēlā me kēia manawa mākou e hōʻano hou i kahi kelepona ma ke kolamu B (mai ka lālani 1 a hiki i ka lālani 10), e hōʻike ʻokoʻa ka cell i ka kolamu A i ka lā a me ka manawa o kēia manawa.
Ercole Palmeri
E hoʻomau ʻo Coveware e Veeam i ka hoʻolako ʻana i nā lawelawe pane ʻana i ka hanana cyber extortion. E hāʻawi ʻo Coveware i nā forensics a me nā mana hoʻoponopono…
Ke hoʻololi nei ka mālama wānana ʻana i ka ʻāpana ʻaila a me ke kinoea, me kahi ala hou a hoʻoikaika i ka hoʻokele mea kanu.…
Ua hoʻopuka ka UK CMA i kahi ʻōlelo aʻo e pili ana i ka hana a Big Tech i ka mākeke naʻauao. Aia…
ʻO ka "Case Green" Decree, i hoʻokumu ʻia e ka European Union e hoʻonui ai i ka ikehu o nā hale, ua hoʻopau i kāna kaʻina hana kānāwai me…