மதிப்பிடப்பட்ட வாசிப்பு நேரம்: 3 நிமிடங்கள்
பின்வரும் துணை செயல்முறையானது செயலில் உள்ள பணித்தாளின் நெடுவரிசை A இல் உள்ள கலங்களிலிருந்து வெற்று கலத்தை எதிர்கொள்ளும் வரை மதிப்புகளைப் படிக்கிறது. மதிப்புகள் ஒரு வரிசையில் சேமிக்கப்படும். இந்த எளிய எக்செல் மேக்ரோ உதாரணம் இதைப் பயன்படுத்துவதை விளக்குகிறது:
Do Until
;Ubound
பில்டின் (இது ஒரு வரிசையின் மிக உயர்ந்த குறியீட்டை வழங்குகிறது).' 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 நெடுவரிசையில் உள்ள மதிப்புகளை இந்த செயல்முறை ஒரு வரிசையில் சேமிக்கிறது, அதைக் கவனிக்கவும்:
Do Until
வெற்று செல்களைப் புறக்கணித்து, செயலில் உள்ள ஒர்க்ஷீட்டின் A நெடுவரிசையில் உள்ள ஒவ்வொரு கலத்தின் மதிப்புகளையும் பிரித்தெடுக்கிறதுIf UBound(dCellValues) < iRow
” dCellValues வரிசையானது தகவலை வைத்திருக்கும் அளவுக்கு பெரியதாக உள்ளதா என சரிபார்க்கிறது, இல்லையெனில், வரிசையின் அளவை 10 ஆல் அதிகரிக்க ReDim ஐப் பயன்படுத்தவும்.dCellValues(iRow) = Cells(iRow, 1).Value
"செல் மதிப்புகள் வரிசையில் தற்போதைய கலத்தை சேமிக்கிறதுபின்வரும் துணை நடைமுறையானது "Sheet2" என்ற பணித்தாளின் நெடுவரிசை A இலிருந்து மதிப்புகளைப் படிக்கிறது மற்றும் மதிப்புகளில் எண்கணித செயல்பாடுகளைச் செய்கிறது. இதன் விளைவாக வரும் மதிப்புகள் தற்போதைய செயலில் உள்ள பணித்தாளின் நெடுவரிசை A இல் அச்சிடப்படுகின்றன.
இந்த மேக்ரோ விளக்குகிறது:
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 மேக்ரோவை எழுதுவோம். நீங்கள் B நெடுவரிசையில் (B4 முதல் B11 வரை) மாற்றங்களைக் கண்காணிக்க விரும்புகிறீர்கள் மற்றும் A நெடுவரிசையில் மாற்றத்தின் தேதி மற்றும் நேரத்தை பதிவு செய்ய வேண்டும் என்று வைத்துக்கொள்வோம்.
இவ்வாறு தொடரலாம்:
Developer
விருப்பத்தை சொடுக்கவும்"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 எச்சரிக்கை விடுத்துள்ளது. அங்கு…
கட்டிடங்களின் ஆற்றல் திறனை மேம்படுத்த ஐரோப்பிய ஒன்றியத்தால் உருவாக்கப்பட்ட "கேஸ் கிரீன்" ஆணை, அதன் சட்டமன்ற செயல்முறையை முடித்தது...