non so che titolo scrivere



  • [non so che titolo scrivere]
    di gio (utente non iscritto) data: 19/10/2012 09:24:10

    ho un foglio di lavoro con dentro tante righe..
    ogni parola/numero è suddiviso in una cella diversa

    PROFILE OF SURFACE 0.0101 0 0.0101 0.025 -0.025
    PROFILE OF SURFACE -0.0073 0 -0.0073 0.015 -0.015
    PROFILE OF SURFACE -0.0132 0 -0.0132 0.102 -0.102

    questa riga di comando però mi da alcuni problemi..cioè in passato non me ne dava...adesso ha inziiato che non fa piu quello che deve
    If IsNumeric(Cells(i, 4)) And Cells(i, 1) = "PROFILE" Then

    con questa riga vado a selezionare proprio la parte di file che ho copiato qui sopra..
    e con questi comandi
    .Cells(25 + k, y) = Cells(i, 2 + j)
    .Cells(6, y) = Cells(i, 1 + y)
    .Cells(7, y) = Cells(i, 3 + y) 'nominali
    .Cells(8, y) = Cells(i, 3 + y) + Cells(i, 5) 'valori max toll
    .Cells(9, y) = Cells(i, 3 + y) + Cells(i, 6) 'valori min toll
    y = y + 1

    in teoria vado a completare un foglio di risultati..peccato che li esegue ma non hanno effetto i comandi che copiano nelle righe 6 e 7...mentre gli altri si...come mai?
     
        k = 0                            'valori misurati quote strane
        For j = 0 To Cells(Columns.Count).End(xlToLeft).Column Step dist
        y = m + 5
        For i = offset To Cells(Rows.Count, 1).End(xlUp).Row
            With Sheets("eCAV")
                If (IsNumeric(Trim(Cells(i, 2))) And IsNumeric(Trim(Cells(i - 1, 2)))) Or (IsNumeric(Trim(Cells(i, 2))) And Trim(Cells(i - 1, 2).Value = "")) And IsNumeric(Trim(Cells(i, 3))) Then
                 .Cells(25 + k, y) = Cells(i, 2 + j)
                 .Cells(6, y) = Cells(i, 1 + y)
                 .Cells(7, y) = Cells(i, 3 + y)                'nominali
                 .Cells(8, y) = Cells(i, 3 + y) + Cells(i, 5)  'valori max toll
                 .Cells(9, y) = Cells(i, 3 + y) + Cells(i, 6)  'valori min toll
                 y = y + 1
                End If
                                                  'nominali quote strane
               If IsNumeric(Cells(i, 4)) And Cells(i, 1) = "PROFILE" Then
                 
                 .Cells(6, y) = ""
                 For h = 2 To dist                   'nomi quote
                  .Cells(6, y) = .Cells(6, y) & " " & Cells(i - 1, h)
                 Next h
               
                 .Cells(25 + k, y) = Cells(i, 4 + j)
                 .Cells(7, y) = Cells(i, 5 + y)                'nominali
                 .Cells(8, y) = Cells(i, 5 + y) + Cells(i, 7)  'valori max toll
                 .Cells(9, y) = Cells(i, 5 + y) + Cells(i, 8)  'valori min toll
                y = y + 1
               End If
           End With
        Next i
        k = k + 1
        Next j



  • di gio (utente non iscritto) data: 19/10/2012 09:27:58

    no scusate ho sbagliato..
    la parte che da errore è riferita a questa parte di file

    PERPENDICULARITY 0.0156 0 0.0156 0.05 0
    PARALLELISM 0.0086 0 0.0086 0.05 0
    FLATNESS 0.0017 0 0.0017 0.038 0
    FLATNESS 0.0012 0 0.0012 0.038 0
    ANGULARITY 0.0162 0 0.0162 0.05 0
    FLATNESS 0.0067 0 0.0067 0.038 0


     
        For i = offset To Cells(Rows.Count, 1).End(xlUp).Row
            With Sheets("eCAV")
                If (IsNumeric(Trim(Cells(i, 2))) And IsNumeric(Trim(Cells(i - 1, 2)))) Or (IsNumeric(Trim(Cells(i, 2))) And Trim(Cells(i - 1, 2).Value = "")) And IsNumeric(Trim(Cells(i, 3))) Then
                 .Cells(25 + k, y) = Cells(i, 2 + j)
                 .Cells(6, y) = Cells(i, 1 + y)
                 .Cells(7, y) = Cells(i, 3 + y)                'nominali
                 .Cells(8, y) = Cells(i, 3 + y) + Cells(i, 5)  'valori max toll
                 .Cells(9, y) = Cells(i, 3 + y) + Cells(i, 6)  'valori min toll
                 y = y + 1
                End If



  • di Vecchio Frac data: 19/10/2012 15:58:28

    cit. " la parte che da errore "
    --> Quindi ti viene segnalato un errore? quale? il codice si ferma su quale riga?
    Probabilmente "offset" non è inizializzata, perciò "i" vale zero e quindi è un valore non ammesso.
    Senza contare che chiamare "offset" una variabile è poco consigliato, perchè è una delle proprietà di un Range e si rischia di far fare confusione ad Excel.