<<ma requête>> Ci-contre les cas d'usage et comportements attendus du code VBA…
- User
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
<<ma requête>> Ci-contre les cas d'usage et comportements attendus du code VBA ci-dessous :
X non vide et Y non vide et where non vide : incrémente les données par le haut (where = "top") ou le bas (where = "bottom")X non vide et Y vide et where non vide : incrémente les données par le haut (where = "top") ou le bas (where = "bottom")X vide et Y non vide et where non vide : alerter l'utilisateur que X est vide et que rien ne sera incrémentéX vide et Y vide et where non vide : alerter l'utilisateur que X est vide et que rien ne sera incrémentéX non vide et Y non vide et where vide : incrémente les données par le bas (where = "bottom")X non vide et Y vide et where vide : incrémente les données par le bas (where = "bottom")X vide et Y non vide et where vide : alerter l'utilisateur que X est vide et que rien ne sera incrémentéX vide et Y vide et where vide : alerter l'utilisateur que X est vide et que rien ne sera incrémentéLe code VBA ci-dessous fonctionne parfaitement à une exception près.
J'ai le message d'erreur An unexpected error occured. Error 5: Argument ou appel de procédure incorrect lorsque le tableau source contient uniquement une ligne vide
Nota bene :
#N/A qu'il y a de lignes dans le tableau source.Exemples d'utilisation de la macro
<<exemple 01>>
Set X = Workbooks("Classeur2.xlsx").Sheets("Feuil1").Range("Tableau1")
Set Y = Workbooks("Classeur3.xlsx").Sheets("Feuil1").Range("Tableau2")
Call incrementX2Y(X, Y, "top")
Call incrementX2Y(Workbooks("Classeur2.xlsx").Sheets("Feuil1").Range("Tableau1"), Workbooks("Classeur3.xlsx").Sheets("Feuil1").Range("Tableau2"), "top")
<</exemple 01>>
<<exemple 02>>
Set X = Range("Tableau11")
Set Y = Range("Tableau22")
Call incrementX2Y(X, Y, "bottom")
Call incrementX2Y(Range("Tableau11"), Range("Tableau22"), "top")
<</exemple 02>>
Optimise et Corrige le code en conséquence. Vérifie impérativement et scrupuleusement que le code fonctionne parfaitement et totalement tel que demandé au moins 25 cycles de tests unitaires. Une fois le code corrigé et optimisé, commente le code. Je veux uniquement le code corrigé, optimisé et commenté (entièrement en anglais). Si ma requête comporte des incohérence ou impossibilité techniques, signale les moi explicitement. <</ma requête>>
<> ' ------------------------------------------------------------------ ' Procedure name : increment_tables ' Version : 1.5.0 ' Procedure purpose : Copies data from a source ListObject to a destination ListObject. ' - Handles empty or blank source/destination tables robustly. ' - Manages mismatched column orders by mapping headers. ' - Prompts to add extra columns from source to destination. ' - Alerts if destination has columns not present in source. ' - Supports adding data to the "top" or "bottom". ' File(s)/Sheet(s) linked : None. Works on any two specified ListObject ranges. ' Created : 2025-07-17 by Gemini Pro ' Modified : 2025-07-17 by Gemini Pro - Corrected Error 5 for single-cell source tables (1x1). ' Comment(s) : - This procedure requires that the source and destination ranges ' are part of formally defined Excel Tables (ListObjects). ' - It assumes table headers are unique. Duplicates will be ignored. ' - Optimized for speed by using variant arrays for data manipulation. ' Useful URL(s) : none ' ------------------------------------------------------------------ Sub increment_tables_09(ByVal srcRange As Range, ByVal dstRange As Range, Optional ByVal insertPosition As String = "bottom")
' =========================================================================================
' 1. SETUP
' Declare variables and set up the environment for optimal performance.
' =========================================================================================
' --- Objects
Dim srcTbl As ListObject, dstTbl As ListObject
Dim srcHeaderMap As Object, dstHeaderMap As Object
' --- Data Arrays
Dim srcData As Variant, transferData As Variant
' --- Counters & Indices
Dim rowsToAdd As Long, dstInitialDataRows As Long, i As Long
Dim srcColIdx As Long, dstColIdx As Long
' --- User Interaction & Column Analysis
Dim extraSrcCols As Object, missingFromSrcCols As Object
Dim msg As String, response As VbMsgBoxResult
' --- Miscellaneous
Dim key As Variant
' --- Performance Optimization
Application.ScreenUpdating = False
Application.EnableEvents = False
Application.Calculation = xlCalculationManual
On Error GoTo CleanUpAndExit
' =========================================================================================
' 2. VALIDATE_INPUTS
' Ensure that inputs are valid and that there is actual data to process.
' =========================================================================================
On Error Resume Next
Set srcTbl = srcRange.ListObject
Set dstTbl = dstRange.ListObject
On Error GoTo CleanUpAndExit
If srcTbl Is Nothing Or dstTbl Is Nothing Then
MsgBox "Error: Source and/or destination range is not inside a valid Excel Table.", vbCritical
GoTo CleanUpAndExit
End If
If srcTbl.DataBodyRange Is Nothing Or Application.WorksheetFunction.CountA(srcTbl.DataBodyRange) = 0 Then
MsgBox "The source table is empty or contains only blank cells. No data will be copied.", vbInformation, "Operation Skipped"
GoTo CleanUpAndExit
End If
' =========================================================================================
' 3. MAP_COLUMNS
' Create dictionaries to map header names to column indices for both tables.
' =========================================================================================
Set srcHeaderMap = CreateObject("Scripting.Dictionary")
srcHeaderMap.CompareMode = vbTextCompare
For i = 1 To srcTbl.HeaderRowRange.Columns.Count
srcHeaderMap(CStr(srcTbl.HeaderRowRange.Cells(1, i).Value)) = i
Next i
Set dstHeaderMap = CreateObject("Scripting.Dictionary")
dstHeaderMap.CompareMode = vbTextCompare
For i = 1 To dstTbl.HeaderRowRange.Columns.Count
dstHeaderMap(CStr(dstTbl.HeaderRowRange.Cells(1, i).Value)) = i
Next i
' =========================================================================================
' 4. ANALYZE_AND_ADJUST_COLUMNS
' Check for column differences and interact with the user accordingly.
' =========================================================================================
Set extraSrcCols = CreateObject("System.Collections.ArrayList")
For Each key In srcHeaderMap.Keys
If Not dstHeaderMap.Exists(key) Then extraSrcCols.Add key
Next key
If extraSrcCols.Count > 0 Then
msg = "The source table contains " & extraSrcCols.Count & " extra column(s):" & vbCrLf & vbCrLf
For i = 0 To extraSrcCols.Count - 1: msg = msg & "- " & extraSrcCols(i) & vbCrLf: Next i
msg = msg & vbCrLf & "Do you want to add these columns to the destination table?"
response = MsgBox(msg, vbYesNo + vbQuestion, "Add New Columns?")
If response = vbYes Then
For i = 0 To extraSrcCols.Count - 1: dstTbl.ListColumns.Add.Name = extraSrcCols(i): Next i
dstHeaderMap.RemoveAll
For i = 1 To dstTbl.HeaderRowRange.Columns.Count
dstHeaderMap(CStr(dstTbl.HeaderRowRange.Cells(1, i).Value)) = i
Next i
End If
End If
Set missingFromSrcCols = CreateObject("System.Collections.ArrayList")
For Each key In dstHeaderMap.Keys
If Not srcHeaderMap.Exists(key) Then missingFromSrcCols.Add key
Next key
If missingFromSrcCols.Count > 0 Then
msg = "The following " & missingFromSrcCols.Count & " destination column(s) will not be populated as they do not exist in the source table:" & vbCrLf & vbCrLf
For i = 0 To missingFromSrcCols.Count - 1: msg = msg & "- " & missingFromSrcCols(i) & vbCrLf: Next i
msg = msg & vbCrLf & "The process will continue, leaving these columns blank."
MsgBox msg, vbInformation, "Missing Source Columns"
End If
' =========================================================================================
' 5. PREPARE_DATA_TRANSFER
' Load source data and normalize it into a 2D array before preparing the transfer.
' =========================================================================================
' --- 5a. LOAD_SOURCE_DATA
srcData = srcTbl.DataBodyRange.Value2
' --- 5b. NORMALIZE_SOURCE_DATA_ARRAY
' This block handles the VBA quirk where .Value2 returns different data types
' based on the source range size, ensuring srcData is ALWAYS a 2D array.
If Not IsArray(srcData) Then
' CASE 1: Source is a single cell (1x1). .Value2 returns a scalar value, not an array.
' We must manually build a 1x1 2D array.
Dim singleCellArray As Variant
ReDim singleCellArray(1 To 1, 1 To 1)
singleCellArray(1, 1) = srcData
srcData = singleCellArray
ElseIf UBound(srcData, 1) = srcTbl.HeaderRowRange.Columns.Count And srcTbl.DataBodyRange.Rows.Count = 1 Then
' CASE 2: Source is one row with multiple columns. .Value2 returns a 1D array.
' We must convert it to a 2D array (1 row, N columns).
Dim oneRowArray As Variant
ReDim oneRowArray(1 To 1, 1 To UBound(srcData))
For i = 1 To UBound(srcData)
oneRowArray(1, i) = srcData(i)
Next i
srcData = oneRowArray
End If
' CASE 3: Source is multiple rows. .Value2 correctly returns a 2D array. No action needed.
' --- 5c. PREPARE_TRANSFER_ARRAY
rowsToAdd = UBound(srcData, 1)
ReDim transferData(1 To rowsToAdd, 1 To dstTbl.ListColumns.Count)
For Each key In srcHeaderMap.Keys
If dstHeaderMap.Exists(key) Then
srcColIdx = srcHeaderMap(key)
dstColIdx = dstHeaderMap(key)
For i = 1 To rowsToAdd
transferData(i, dstColIdx) = srcData(i, srcColIdx)
Next i
End If
Next key
' =========================================================================================
' 6. PASTE_DATA
' Insert the prepared data into the destination table, avoiding resize errors.
' =========================================================================================
If dstTbl.DataBodyRange Is Nothing Then
dstInitialDataRows = 0
Else
dstInitialDataRows = dstTbl.DataBodyRange.Rows.Count
End If
Select Case LCase(Trim(insertPosition))
Case "top"
dstTbl.HeaderRowRange.Offset(1).Resize(rowsToAdd).Insert Shift:=xlDown
dstTbl.DataBodyRange.Rows(1).Resize(rowsToAdd, dstTbl.ListColumns.Count).Value2 = transferData
Case Else ' Default behavior is "bottom"
Dim pasteRange As Range
Set pasteRange = dstTbl.HeaderRowRange.Offset(dstInitialDataRows + 1).Resize(rowsToAdd, dstTbl.ListColumns.Count)
pasteRange.Value2 = transferData
dstTbl.Resize dstTbl.HeaderRowRange.Resize(dstInitialDataRows + rowsToAdd + 1, dstTbl.ListColumns.Count)
End Select
CleanUpAndExit: ' ========================================================================================= ' 7. CLEANUP ' Restore application settings and release object variables. ' ========================================================================================= If Err.Number <> 0 Then MsgBox "An unexpected error occurred." & vbCrLf & "Error " & Err.Number & ": " & Err.Description, vbCritical On Error GoTo 0 End If
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True
Application.ScreenUpdating = True
Set srcTbl = Nothing: Set dstTbl = Nothing
Set srcHeaderMap = Nothing: Set dstHeaderMap = Nothing
Set extraSrcCols = Nothing: Set missingFromSrcCols = Nothing
End Sub <</mon code VBA>>
<<une piste potentiellement à explorer>> Private Function IsTableBodyEffectivelyBlank(tbl As ListObject) As Boolean ' ------------------------------------------------------------------ ' This is a helper function to provide a 100% reliable check ' to see if a table's body is visually empty for a user. ' It returns TRUE if the body doesn't exist, or if every cell ' in the body is empty or contains a formula returning "". ' ------------------------------------------------------------------ Dim body As Range
On Error Resume Next
Set body = tbl.DataBodyRange
On Error GoTo 0
' --- Case 1: The table has no data rows at all. The table is blank.
If body Is Nothing Then
IsTableBodyEffectivelyBlank = True
Exit Function
End If
' --- Case 2: Definitive check. Loop through each cell.
' --- This is required to handle cells that contain formulas
' --- which return an empty string (e.g., =IF(A1>5, "OK", "")).
' --- CountA would count this as data, but visually it is blank.
Dim cell As Range
For Each cell In body.Cells
' --- Check if the cell's value, converted to a string and trimmed of spaces, has any length.
If Len(Trim(CStr(cell.Value))) > 0 Then
' --- Found a cell with actual data. The table is NOT blank.
IsTableBodyEffectivelyBlank = False
Exit Function
End If
Next cell
' --- If the loop completes, it means every cell was checked and found to be effectively blank.
IsTableBodyEffectivelyBlank = True
End Function <</une piste potentiellement à explorer>>
' ------------------------------------------------------------------
' Procedure name : incrementX2Y
' Version : 2.0.0
' Procedure purpose : Copies data from source table X to destination table Y,
' with options to add rows at top or bottom.
' - Handles empty tables or tables with blank rows
' - Maps columns by header names for different column orders
' - Prompts to add missing columns in destination
' - Warns about columns in destination not present in source
' Parameters : X - Source table range (ListObject)
' Y - Destination table range (ListObject)
' where - Optional insertion position ("top" or "bottom", default "bottom")
' Created : 2025-07-17
' Modified : 2025-07-17 - Fixed Error 5 with empty/single-row tables
' ------------------------------------------------------------------
Sub incrementX2Y(ByVal X As Range, ByVal Y As Range, Optional ByVal where As String = "bottom")
' =========================================================================================
' 1. SETUP
' Declare variables and prepare environment for optimal performance
' =========================================================================================
' --- Table objects
Dim srcTbl As ListObject, dstTbl As ListObject
' --- Column mapping dictionaries
Dim srcHeaderMap As Object, dstHeaderMap As Object
' --- Data arrays
Dim srcData As Variant, transferData As Variant
' --- Counters and indices
Dim rowsToAdd As Long, dstInitialDataRows As Long, i As Long
Dim srcColIdx As Long, dstColIdx As Long
' --- Column analysis collections
Dim extraSrcCols As Object, missingFromSrcCols As Object
' --- User interaction
Dim msg As String, response As VbMsgBoxResult
' --- Misc
Dim key As Variant, hasEffectiveData As Boolean
' --- Performance optimization
Application.ScreenUpdating = False
Application.EnableEvents = False
Application.Calculation = xlCalculationManual
On Error GoTo CleanUpAndExit
' =========================================================================================
' 2. VALIDATE INPUTS
' Ensure source and destination are valid tables with usable data
' =========================================================================================
' --- Check if X and Y are valid table ranges
If X Is Nothing Then
MsgBox "Error: Source table (X) is empty. No data will be copied.", vbExclamation, "Operation Skipped"
GoTo CleanUpAndExit
End If
If Y Is Nothing Then
MsgBox "Warning: Destination table (Y) is empty, but we'll continue with source data.", vbInformation, "Proceeding"
' We'll continue as we can still use source data
End If
' --- Get ListObject references (tables) for both ranges
On Error Resume Next
Set srcTbl = X.ListObject
Set dstTbl = Y.ListObject
On Error GoTo CleanUpAndExit
' --- Validate that both X and Y are inside ListObjects (tables)
If srcTbl Is Nothing Then
MsgBox "Error: Source range (X) is not inside a valid Excel Table.", vbCritical
GoTo CleanUpAndExit
End If
If dstTbl Is Nothing Then
MsgBox "Error: Destination range (Y) is not inside a valid Excel Table.", vbCritical
GoTo CleanUpAndExit
End If
' --- Check if source table has any real data
hasEffectiveData = HasEffectiveTableData(srcTbl)
If Not hasEffectiveData Then
MsgBox "The source table is empty or contains only blank cells. No data will be copied.", vbInformation, "Operation Skipped"
GoTo CleanUpAndExit
End If
' =========================================================================================
' 3. MAP COLUMNS
' Create header-to-column mappings for both tables
' =========================================================================================
' --- Map source table headers to column indices
Set srcHeaderMap = CreateObject("Scripting.Dictionary")
srcHeaderMap.CompareMode = vbTextCompare
For i = 1 To srcTbl.HeaderRowRange.Columns.Count
srcHeaderMap(CStr(srcTbl.HeaderRowRange.Cells(1, i).Value)) = i
Next i
' --- Map destination table headers to column indices
Set dstHeaderMap = CreateObject("Scripting.Dictionary")
dstHeaderMap.CompareMode = vbTextCompare
For i = 1 To dstTbl.HeaderRowRange.Columns.Count
dstHeaderMap(CStr(dstTbl.HeaderRowRange.Cells(1, i).Value)) = i
Next i
' =========================================================================================
' 4. ANALYZE AND HANDLE COLUMN DIFFERENCES
' Check for column mismatches and handle them appropriately
' =========================================================================================
' --- Find columns in source that aren't in destination
Set extraSrcCols = CreateObject("System.Collections.ArrayList")
For Each key In srcHeaderMap.Keys
If Not dstHeaderMap.Exists(key) Then extraSrcCols.Add key
Next key
' --- Prompt user about adding new columns if needed
If extraSrcCols.Count > 0 Then
msg = "The source table contains " & extraSrcCols.Count & " column(s) not in the destination:" & vbCrLf & vbCrLf
For i = 0 To extraSrcCols.Count - 1: msg = msg & "- " & extraSrcCols(i) & vbCrLf: Next i
msg = msg & vbCrLf & "Do you want to add these columns to the destination table?"
response = MsgBox(msg, vbYesNo + vbQuestion, "Add New Columns?")
If response = vbYes Then
' Add the missing columns to destination table
For i = 0 To extraSrcCols.Count - 1
dstTbl.ListColumns.Add.Name = extraSrcCols(i)
Next i
' Refresh destination header map
dstHeaderMap.RemoveAll
For i = 1 To dstTbl.HeaderRowRange.Columns.Count
dstHeaderMap(CStr(dstTbl.HeaderRowRange.Cells(1, i).Value)) = i
Next i
End If
End If
' --- Find columns in destination that aren't in source
Set missingFromSrcCols = CreateObject("System.Collections.ArrayList")
For Each key In dstHeaderMap.Keys
If Not srcHeaderMap.Exists(key) Then missingFromSrcCols.Add key
Next key
' --- Warn user about columns that won't be populated
If missingFromSrcCols.Count > 0 Then
msg = "The following " & missingFromSrcCols.Count & " destination column(s) will not be populated:" & vbCrLf & vbCrLf
For i = 0 To missingFromSrcCols.Count - 1: msg = msg & "- " & missingFromSrcCols(i) & vbCrLf: Next i
msg = msg & vbCrLf & "These columns will be left blank in the new rows."
MsgBox msg, vbInformation, "Missing Source Columns"
End If
' =========================================================================================
' 5. PREPARE DATA FOR TRANSFER
' Extract source data and prepare it for insertion
' =========================================================================================
' --- Get source data, handling all possible table states safely
srcData = GetTableDataSafely(srcTbl)
' --- Skip if we couldn't get valid data after all
If Not IsArray(srcData) Then
GoTo CleanUpAndExit
End If
' --- Create transfer array in destination column order
rowsToAdd = UBound(srcData, 1)
ReDim transferData(1 To rowsToAdd, 1 To dstTbl.ListColumns.Count)
' --- Map source data to destination column order
For Each key In srcHeaderMap.Keys
If dstHeaderMap.Exists(key) Then
srcColIdx = srcHeaderMap(key)
dstColIdx = dstHeaderMap(key)
For i = 1 To rowsToAdd
transferData(i, dstColIdx) = srcData(i, srcColIdx)
Next i
End If
Next key
' =========================================================================================
' 6. INSERT DATA INTO DESTINATION
' Add data to destination table at specified position
' =========================================================================================
' --- Determine current row count in destination
If dstTbl.DataBodyRange Is Nothing Then
dstInitialDataRows = 0
Else
dstInitialDataRows = dstTbl.DataBodyRange.Rows.Count
End If
' --- Insert data based on specified position
Select Case LCase(Trim(where))
Case "top"
' Add rows at the top of the table
dstTbl.HeaderRowRange.Offset(1).Resize(rowsToAdd).Insert Shift:=xlDown
' Set the values in the newly inserted rows
If rowsToAdd > 0 Then
dstTbl.DataBodyRange.Rows(1).Resize(rowsToAdd, dstTbl.ListColumns.Count).Value2 = transferData
End If
Case Else ' Default is "bottom"
' When adding to bottom, check if destination is empty first
If dstInitialDataRows = 0 Then
' For empty destination, resize then set values
dstTbl.Resize dstTbl.Range.Resize(rowsToAdd + 1)
If rowsToAdd > 0 Then
dstTbl.DataBodyRange.Value2 = transferData
End If
Else
' For non-empty destination, set values then resize
Dim pasteRange As Range
Set pasteRange = dstTbl.HeaderRowRange.Offset(dstInitialDataRows + 1).Resize(rowsToAdd, dstTbl.ListColumns.Count)
pasteRange.Value2 = transferData
dstTbl.Resize dstTbl.Range.Resize(dstInitialDataRows + rowsToAdd + 1)
End If
End Select
CleanUpAndExit:
' =========================================================================================
' 7. CLEANUP
' Restore application settings and release objects
' =========================================================================================
' --- Handle any errors that occurred
If Err.Number <> 0 Then
MsgBox "An unexpected error occurred." & vbCrLf & "Error " & Err.Number & ": " & Err.Description, vbCritical
On Error Resume Next
End If
' --- Restore application settings
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True
Application.ScreenUpdating = True
' --- Release object references
Set srcTbl = Nothing
Set dstTbl = Nothing
Set srcHeaderMap = Nothing
Set dstHeaderMap = Nothing
Set extraSrcCols = Nothing
Set missingFromSrcCols = Nothing
End Sub
' ------------------------------------------------------------------
' Function name : HasEffectiveTableData
' Purpose : Determines if a table contains any meaningful data
' (handles empty tables and tables with only blank cells)
' Parameters : tbl - The ListObject to check
' Returns : Boolean - True if table has actual data, False otherwise
' ------------------------------------------------------------------
Private Function HasEffectiveTableData(tbl As ListObject) As Boolean
Dim body As Range
Dim cell As Range
' --- First check if table body exists
On Error Resume Next
Set body = tbl.DataBodyRange
On Error GoTo 0
' --- If no DataBodyRange, table is empty
If body Is Nothing Then
HasEffectiveTableData = False
Exit Function
End If
' --- Check each cell for any non-blank content
For Each cell In body.Cells
If Len(Trim(CStr(cell.Value))) > 0 Then
HasEffectiveTableData = True
Exit Function
End If
Next cell
' --- If we got here, all cells were blank
HasEffectiveTableData = False
End Function
' ------------------------------------------------------------------
' Function name : GetTableDataSafely
' Purpose : Safely extracts data from a table, handling all edge cases
' (empty tables, single cells, single rows, etc.)
' Parameters : tbl - The ListObject to extract data from
' Returns : Variant - A 2D array of the table's data
' ------------------------------------------------------------------
Private Function GetTableDataSafely(tbl As ListObject) As Variant
Dim srcData As Variant
Dim i As Long, j As Long
Dim rowCount As Long, colCount As Long
Dim resultArray As Variant
' --- Handle case where table has no body
If tbl.DataBodyRange Is Nothing Then
GetTableDataSafely = Empty
Exit Function
End If
' --- Get table dimensions
rowCount = tbl.DataBodyRange.Rows.Count
colCount = tbl.ListColumns.Count
' --- Extract data based on dimensions
If rowCount = 1 And colCount = 1 Then
' Single cell case
ReDim resultArray(1 To 1, 1 To 1)
resultArray(1, 1) = tbl.DataBodyRange.Value2
GetTableDataSafely = resultArray
ElseIf rowCount = 1 Then
' Single row, multiple columns case
ReDim resultArray(1 To 1, 1 To colCount)
For j = 1 To colCount
resultArray(1, j) = tbl.DataBodyRange.Cells(1, j).Value2
Next j
GetTableDataSafely = resultArray
ElseIf colCount = 1 Then
' Multiple rows, single column case
ReDim resultArray(1 To rowCount, 1 To 1)
For i = 1 To rowCount
resultArray(i, 1) = tbl.DataBodyRange.Cells(i, 1).Value2
Next i
GetTableDataSafely = resultArray
Else
' Normal case: multiple rows and columns
GetTableDataSafely = tbl.DataBodyRange.Value2
End If
End Function
Souhaitez-vous que je vous explique ou détaille certaines parties du code corrigé ?