Foro de Ayuda Excel | ||
| Soluciona tus problemas con Excel |
| | |||||||
| Registrarse | Preguntas Frecuentes | Lista de Foreros | Calendario | Buscar | Temas de Hoy | Marcar Foros Como Leídos |
| | LinkBack | Herramientas | Desplegado |
|
#1
| |||
| |||
| hola tengo el sgte problema tengo que realizar un informe (añadir un ahoja en el mismo libro con ciertos datos) que de un rango seleccionado detecte los errores que hayan en las celdas (#VALUE!,#DIV/0!,#NAME?,#VALUE!,#REF!) y ponga una posible solucion del error o una descripcion de el estoy trabajando asi Dim celda, fila As Range Dim i As Integer Dim lastRow As Long lastRow = Selection.Rows.count Dim outPutArray As Variant ReDim outPutArray(lastRow, 3) As Variant Dim lastRowArray As Long lastRowArray = 1 outPutArray(0, 0) = "#" outPutArray(0, 1) = "Position" outPutArray(0, 2) = "Error Type" outPutArray(0, 3) = "Possible Solution" For Each celda In Selection If IsError(celda.value) Then outPutArray(lastRowArray, 0) = lastRowArray outPutArray(lastRowArray, 1) = Replace(celda.Address, "$", "") outPutArray(lastRowArray, 2) = CVErr(celda.value) outPutArray(lastRowArray, 3) = CVErr(celda.value) lastRowArray = lastRowArray + 1 End If Next celda la parte del informe la tengo lista solo necesito pasarle el array (outPutArray) pero me falta saber la descripcion del error existe algo como error.description(celda.value)?? |
|
#2
| |||
| |||
| Dim celda, fila As Range Dim i As Integer Dim rowCount, colCount As Long colCount = Selection.Columns.count rowCount = Selection.Rows.count 'Output: Array to storage the result of the analysis Dim outPutArray As Variant ReDim outPutArray(rowCount * colCount, 3) As Variant Dim lastRowArray As Long lastRowArray = 1 outPutArray(0, 0) = "#" outPutArray(0, 1) = "Position" outPutArray(0, 2) = "Error Type" outPutArray(0, 3) = "Possible Solution" For Each fila In Selection.Rows For Each celda In fila.Cells If IsError(celda.value) Then outPutArray(lastRowArray, 0) = lastRowArray outPutArray(lastRowArray, 1) = Replace(celda.Address, "$", "") outPutArray(lastRowArray, 2) = CVErr(celda.value) 'outPutArray(lastRowArray, 3) = queda vacio If CInt(outPutArray(lastRowArray, 2)) = 2029 Then '#NAME? outPutArray(lastRowArray, 3) = "Function no valid" End If If CInt(outPutArray(lastRowArray, 2)) = 2007 Then '#DIV/0! outPutArray(lastRowArray, 3) = "The formula or function used is dividing by zero or empty cells" End If If CInt(outPutArray(lastRowArray, 2)) = 2015 Then '#VALUE! outPutArray(lastRowArray, 3) = "A value used in the formula is of the wrong data type" End If If CInt(outPutArray(lastRowArray, 2)) = 2023 Then '#REF! outPutArray(lastRowArray, 3) = "Moving or deleting cells caused an invalid cell reference, or function is returning reference error" End If lastRowArray = lastRowArray + 1 End If Next celda Next fila Última edición por eddo fecha: 24/10/08 a las 23:52:19. |
| Herramientas | |
| Desplegado | |
| |