(Solved) – Can’t combine worksheet type with range type

(solved)-–-can’t-combine-worksheet-type-with-range-type

I’m trying to get the value of a cell in a methos where I put the sheet in a parameter.

Sub search(date1, month, sheet, index)

Dim cell As Range
Dim startDate As Integer


Dim textoPlano As Integer
Dim svcPoliza As Integer
Dim svcMarcas As Integer
Dim svcDptos As Integer
Dim svcCotizacionesCme As Integer
Dim svcAniosVehiculo As Integer
Dim svcRiesgoVigente As Integer
Dim svcLineasVehiculos As Integer
Dim svcLeeLocalidades As Integer

Dim hoja As Worksheet
Dim ultimaFila As Long
Dim resultado As Worksheet

Set resultado = ActiveWorkbook.Worksheets("Resultados")
Set hoja = ActiveWorkbook.Worksheets(sheet)

If sheet = "Consolidado" Then
Set hoja = ActiveWorkbook.Worksheets("Consolidado")
End If

ultimaFila = hoja.Cells(hoja.Rows.Count, "G").End(xlUp).Row

    For Each cell In Range("G3:G" & ultimaFila)


        If InStr(cell.Value, "enviarCorreoTextoPlano") > 0 Then
            textoPlano = textoPlano   1
        End If
        If InStr(cell.Value, "svcPolizaRecienteVehiculo") > 0 Then
            svcPoliza = svcPoliza   1
        End If
        If InStr(cell.Value, "svcMarcasVehiculos") > 0 Then
            svcMarcas = svcMarcas   1
        End If
        If InStr(cell.Value, "svcLeeDptos") > 0 Then
            svcDptos = svcDptos   1
        End If
        If InStr(cell.Value, "svcLeeCotizacionesCme") > 0 Then
            svcCotizacionesCme = svcCotizacionesCme   1
        End If
        If InStr(cell.Value, "svcLeeAniosVehiculo") > 0 Then
            svcAniosVehiculo = svcAniosVehiculo   1
        End If
        If InStr(cell.Value, "svcRiesgoVigenteVehiculo") > 0 Then
            svcRiesgoVigente = svcRiesgoVigente   1
        End If
        If InStr(cell.Value, "svcLineasVehiculos") > 0 Then
            svcLineasVehiculos = svcLineasVehiculos   1
        End If
        If InStr(cell.Value, "svcLeeLocalidades") > 0 Then
            svcLeeLocalidades = svcLeeLocalidades   1
        End If

    Next cell
End Sub

I’m trying to put something like this:

hoja.cell.Value

The Debugger shows this error “Method or data member not found”
I think this error is because the worksheet doesn’t know what’s that.

Thanks in advance :).

Leave a Reply

Your email address will not be published. Required fields are marked *