Trasferire un array valorizzato su di un range di celle

Anonimo
2010-06-30T15:13:42+00:00

Ciao,

ho un array di questo tipo:

Codici(100,2)

Praticamente è una cosa del genere

Codici(PENNA,10,PAPER)

Codici(MATITA,2,STABILO)

Codici(GOMMA,3,STADLER)

e cosi via.

Generalmente sfrutto dei cicli for per scrivere nelle celle del mio foglio "Stampa" gli array.

Volevo sapere se esisteva un metodo più corretto e veloce di associare tale matrice ad un range di celle.

Es: su A1: PENNA, su B1: 10, su C1: PAPER.

Grazie e buon lavoro. (ho 2007)

Microsoft 365 e Office | Excel | Per la casa | Windows

Domanda bloccata. Questa domanda è stata eseguita dalla community del supporto tecnico Microsoft. È possibile votare se è utile, ma non è possibile aggiungere commenti o risposte o seguire la domanda.

0 commenti Nessun commento
Risposta accettata dall'autore della domanda
Anonimo
2010-06-30T16:15:50+00:00

Non so se ho capito. Semplificando, prova:

<cut>

Partito un colpo, scusa. In pratica puoi passare l'array ad un range di dimensioni identiche. Vedi anche:

Public Sub m()

    Dim myArray(5, 5) As String

    Dim x As Long

    Dim y As Long

    Dim sh As Worksheet

    Dim rng As Range

    For x = 0 To 5

        For y = 0 To 5

            myArray(x, y) = "Valore" & x & y

        Next

    Next

    Set sh = ThisWorkbook.Worksheets("Foglio1")

    With sh

        Set rng = .Range("B4:G9")

        rng = myArray()

    End With

    Set rng = Nothing

    Set sh = Nothing

End Sub

Grazie per l'attenzione.


Mauro Gamberini - Microsoft© MVP(Excel)

http://www.maurogsc.eu/

La risposta è stata utile?

0 commenti Nessun commento

3 risposte aggiuntive

Ordina per: Più utili
  1. Anonimo
    2010-06-30T17:02:48+00:00

    Grazie a te per il cortese riscontro.


    Mauro Gamberini - Microsoft© MVP(Excel)

    http://www.maurogsc.eu/

    La risposta è stata utile?

    0 commenti Nessun commento
  2. Anonimo
    2010-06-30T16:58:12+00:00

    Molto bene.

    Grazie

    La risposta è stata utile?

    0 commenti Nessun commento
  3. Anonimo
    2010-06-30T16:11:09+00:00

    Non so se ho capito. Semplificando, prova:

    Public Sub m()

        Dim myArray(5, 5) As String

        Dim x As Long

        Dim y As Long

        Dim sh As Worksheet

        For x = 0 To 5

            For y = 0 To 5

                myArray(x, y) = "Valore" & x & y

            Next

        Next

        Set sh = ThisWorkbook.Worksheets("Foglio1")

        With sh

            .Range("B4:G9") = myArray()

        End With

        Set sh = Nothing

    End Sub


    Mauro Gamberini - Microsoft© MVP(Excel)

    http://www.maurogsc.eu/

    La risposta è stata utile?

    0 commenti Nessun commento