+ Reply to Thread
Results 1 to 13 of 13

Replace Array values through loop

  1. #1
    Forum Contributor
    Join Date
    07-20-2015
    Location
    Covilhã
    MS-Off Ver
    2010
    Posts
    516

    Replace Array values through loop

    Hello all,

    Hope someone can help me out in my problem

    Please Login or Register  to view this content.
    I have the array defined, i want to loop throught the array and replace the values based on select case "variations"

    Hope you can tell me why isn't the value being replaced when condition is meet, it keeps the older value (empty)

  2. #2
    Forum Contributor
    Join Date
    07-20-2015
    Location
    Covilhã
    MS-Off Ver
    2010
    Posts
    516

    Re: Replace Array values through loop

    Forgot to mention,

    my whole array are strings, and thats where the problem is, i need to replace the string name in the source
    Please Login or Register  to view this content.
    Hope someone can understand me and help me out :D

    I need to change value of the current string being looped, is there a command to put, ActiveString or Array.Index

    Hope someone can understand me and help me out :D
    Last edited by brainzlp; 12-23-2016 at 10:37 PM.

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Replace Array values through loop

    Not really sure what you want to do though,

    If you want to change the value of each string variables, it would be something like
    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    07-20-2015
    Location
    Covilhã
    MS-Off Ver
    2010
    Posts
    516

    Re: Replace Array values through loop

    Hello jindon,

    Thanks for your help, although doesn't work.

    PrimeiraColunaOndeProcurar stills with value "ID Cliente" instead of "NrColIdBDC"

    I put next i at the bottom, my code is :
    Please Login or Register  to view this content.
    I tested with this:
    Please Login or Register  to view this content.
    Myarray(i) gets the correct number, although the primeiracolunaondeprocurar doesn't change...
    Last edited by brainzlp; 12-23-2016 at 11:09 PM.

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Replace Array values through loop

    Then you need to re-allocate each variable like
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    07-20-2015
    Location
    Covilhã
    MS-Off Ver
    2010
    Posts
    516

    Re: Replace Array values through loop

    where do i put that in my code?

    right now i have this:

    Primeiracolunasearch , segundacoluna search, terceiracolunasearch are combobox's from a form

    Please Login or Register  to view this content.

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Replace Array values through loop

    That will be after the loop.

    Or maybe use the Dictionary...
    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    07-20-2015
    Location
    Covilhã
    MS-Off Ver
    2010
    Posts
    516

    Re: Replace Array values through loop

    Quote Originally Posted by jindon View Post
    That will be after the loop.

    Or maybe use the Dictionary...
    I put what you mention, although it doesn't work, have you tested it?
    Please Login or Register  to view this content.
    MsgBox PrimeiraColunaOndeProcurar returns empty..

  9. #9
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Replace Array values through loop

    No variable used in the 2nd option.
    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    07-20-2015
    Location
    Covilhã
    MS-Off Ver
    2010
    Posts
    516

    Re: Replace Array values through loop

    Hello jindon,

    Sorry to bother you,...AGAIN

    It seems to detech the new number, although next i need to filter for that variable, but
    Please Login or Register  to view this content.
    What do i put in the field?

    Hope you can help me out

  11. #11
    Forum Contributor
    Join Date
    07-20-2015
    Location
    Covilhã
    MS-Off Ver
    2010
    Posts
    516

    Re: Replace Array values through loop

    Solved the question, returning the dic values to the variables to filter

    PrimeiraColunaOndeProcurar = dic("PrimeiraColunaOndeProcurar")
    SegundaColunaOndeProcurar = dic("SegundaColunaOndeProcurar")
    TerceiraColunaOndeProcurar = dic("TerceiraColunaOndeProcurar")

    Thanks for your help

  12. #12
    Forum Contributor
    Join Date
    07-20-2015
    Location
    Covilhã
    MS-Off Ver
    2010
    Posts
    516

    Re: Replace Array values through loop

    Thanks for this topic

  13. #13
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Replace Array values through loop

    Glad you found the way.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Assigning array values with a loop
    By Mr. Rogers in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-14-2016, 12:02 PM
  2. [SOLVED] remember values of array created in loop
    By bobmk in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-10-2015, 05:24 PM
  3. Replace Items in a string with corresponding values from an array
    By william1404 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-25-2014, 09:22 PM
  4. updating find and replace values in a macro loop
    By ebr4@duke.edu in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-10-2013, 03:25 AM
  5. Assign fixed values to array / For...Next loop
    By SunOffice in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-18-2011, 05:43 PM
  6. Loop Array values Through a Range and Hide Rows if a Match
    By therzakid in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-29-2011, 01:04 PM
  7. Replace hard coded array in formula with link to input array
    By David Brown in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 01-08-2011, 07:45 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1