+ Reply to Thread
Results 1 to 15 of 15

Data of array

  1. #1
    Registered User
    Join Date
    05-08-2016
    Location
    France
    MS-Off Ver
    2013
    Posts
    58

    Data of array

    Hi everybody!

    I'm a beginner in VBA and need your help please!!
    I have a problem with a code I wrote to apply an operation on an array. I need to take the values of the sheet "TRI" from the row 2 and column 3 to the end. Divide them by the values of cells (i, 2). Then past values in the sheet ("typology"). I'm searching the problem from long time but I can't see what is wrong! It bugs on the red line:

    This is the code :
    Please Login or Register  to view this content.
    Thank you very much if you can explain me what is wrong!
    Last edited by maroon1; 05-15-2016 at 06:27 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    01-08-2011
    Location
    Portsmouth, England
    MS-Off Ver
    Excel 2007 to 2016
    Posts
    456

    Re: Data of array

    Can't see which line is failing.

    Could you attach a small sample workbook with desensitized data so that we can take a look.

    Thanks

  3. #3
    Registered User
    Join Date
    05-08-2016
    Location
    France
    MS-Off Ver
    2013
    Posts
    58

    Re: Data of array

    Hi shirleyxls!

    Thank you for your answer!
    I put an example of file in attachment to see what I need!
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    04-01-2013
    Location
    East Auckland
    MS-Off Ver
    Excel 365
    Posts
    1,343

    Re: Data of array

    What error does it give you? and is it on the first line or is it on another line?

    At a guess.... I think maybe it is type mismatch 13 and your data is not in the right format (i.e. not entirely integers).

  5. #5
    Registered User
    Join Date
    05-08-2016
    Location
    France
    MS-Off Ver
    2013
    Posts
    58

    Re: Data of array

    On this line
    Please Login or Register  to view this content.
    !
    Does it work for you? I don't know what type mismatch 13?

  6. #6
    Forum Expert
    Join Date
    04-01-2013
    Location
    East Auckland
    MS-Off Ver
    Excel 365
    Posts
    1,343

    Re: Data of array

    Your 3rd column has "-" in it and that is not an integer so you cant divide it by 1.2. Which causes a type 13 error
    *guessed it!!*
    Last edited by scottiex; 05-15-2016 at 07:09 PM. Reason: woops wrong way around

  7. #7
    Registered User
    Join Date
    05-08-2016
    Location
    France
    MS-Off Ver
    2013
    Posts
    58

    Re: Data of array

    Does it mean I have to replace " - " by " 0 " in the entire table?

  8. #8
    Forum Expert
    Join Date
    04-01-2013
    Location
    East Auckland
    MS-Off Ver
    Excel 365
    Posts
    1,343

    Re: Data of array

    Yes, or maybe see if this has the desired effect

    Please Login or Register  to view this content.

  9. #9
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Data of array

    Please Login or Register  to view this content.
    In the second part where you make the calculation you refer to the above, but this sheet is empty. In fact you are trying to make calculations with no values.

  10. #10
    Registered User
    Join Date
    05-08-2016
    Location
    France
    MS-Off Ver
    2013
    Posts
    58

    Re: Data of array

    No it's ok, what scottiex gave me works! I didn't thought to do that! I even didn't know that this symbol "-" was the problem!
    That you again!!!

  11. #11
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Data of array

    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    05-08-2016
    Location
    France
    MS-Off Ver
    2013
    Posts
    58

    Re: Data of array

    Thank you for this version!! Just
    Please Login or Register  to view this content.
    and it works!
    But it's less easy for me to understand it! why do you write "-1" here
    Please Login or Register  to view this content.

  13. #13
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Data of array

    Please Login or Register  to view this content.
    has to be
    Please Login or Register  to view this content.
    sn is a matrix of 15 rows and 13 columns. sn(15,13)
    result has to be matrix of 14 rows and 11 columns because you don't need Header row and the first 2 columns of your data. result(14,11)

  14. #14
    Forum Expert
    Join Date
    04-01-2013
    Location
    East Auckland
    MS-Off Ver
    Excel 365
    Posts
    1,343

    Re: Data of array

    Maroon,
    You would have seen all those #N/A that were appearing around your results and that was caused by your result size being wrong as pointed out by bakerman.

  15. #15
    Registered User
    Join Date
    05-08-2016
    Location
    France
    MS-Off Ver
    2013
    Posts
    58

    Re: Data of array

    Yes that right! Now I understand! thank you again!

+ 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. Replies: 1
    Last Post: 02-19-2016, 05:58 AM
  2. [SOLVED] Dynamic Changing Data, Based on Criteria Store in Array, Sum array and store in Cell
    By penbeacho in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-28-2015, 10:31 AM
  3. Take data from array, insert into string, search for string in another array
    By Old4xford in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-12-2015, 02:56 PM
  4. [SOLVED] Find Data in one array and match the position in another array
    By zeeman2 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-27-2013, 07:55 PM
  5. If Condition is True, Save Data in Array, and Copy Array Data to other Worksheet
    By skelly8117 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-10-2013, 10:18 AM
  6. How to write data into an array and retrieve data from array?
    By nigel_12 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-28-2013, 07:06 AM
  7. Removing data that is one array if it is in another array
    By Odie2012 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 11-03-2012, 03: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