+ Reply to Thread
Results 1 to 7 of 7

Konvert Row Range in excel to be Array Format in macros

  1. #1
    Registered User
    Join Date
    06-20-2013
    Location
    Jakarta, Indonesia
    MS-Off Ver
    Excel 2013
    Posts
    12

    Konvert Row Range in excel to be Array Format in macros

    I have a formula that's only work when "Y" and "X" is on column range or array format,
    but the problem is my data source on excel taken by inputbox (userform) is with row range.

    Please Login or Register  to view this content.

    example
    y = range("E5:I5") ==> select this range use inputbox
    x = range("E6:I6") ==> select this range use inputbox

    my question is how to convert range rows data to array format?
    execute the formula or convert data in macros. so, my excel only for data source

    Appreciate if you can help me to made macros codes

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Konvert Row Range in excel to be Array Format in macros

    Hi, ays_punk,

    Your post does not comply with Rule 8 of our Forum RULES. Do not crosspost your question on multiple forums without including links here to the other threads on other forums.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Registered User
    Join Date
    06-20-2013
    Location
    Jakarta, Indonesia
    MS-Off Ver
    Excel 2013
    Posts
    12

    Re: Konvert Row Range in excel to be Array Format in macros

    I'm sorry for my mistake..
    below is the link of my discussion on other forum

    http://www.ozgrid.com/forum/showthre...421#post670421

    Thanks to inform me about the rule.

  4. #4
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Konvert Row Range in excel to be Array Format in macros

    You can convert a range to a two-demsional array by using the equal sign

    Please Login or Register  to view this content.
    This will give you a 2D array with lbound(1) to ubound(100) for the first dimension and 1 to 1 for the second dimension.

    If you want to convert this to a 1D, you can use index or application.transpose:
    Please Login or Register  to view this content.
    Hope this helps.

    abousetta
    Please consider:

    Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
    Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.

  5. #5
    Registered User
    Join Date
    06-20-2013
    Location
    Jakarta, Indonesia
    MS-Off Ver
    Excel 2013
    Posts
    12

    Re: Convert Row Range in excel to be Array Format in macros

    Thanks abousetta, I've already tried this code but couldn't applied to my case.

    To make it easy to understand about my problems,
    i will upload my workbook,
    please run my user form, the step as follow:
    1. select data P by text box to excel worksheet "acak2" sheet, example "E5:AZ5"
    2. same for data Q, select range "E6:AZ6"
    3. skip for input P (i already decide this value on code)
    4. click command button "Hitung" to calculate/process.
    5. the result of text box a1 should be "0.000134904"

    my current condition is when i follow these step, i got the result a1 is "0"
    based on my analysis, i have made a wrong array, because the array on below scrip only show one value (last array)
    Please Login or Register  to view this content.
    I guess i have made a wrong loop to get all the array data extracted from selection range on excel.
    Attached Files Attached Files
    Last edited by ays_punk; 06-24-2013 at 12:08 AM.

  6. #6
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Konvert Row Range in excel to be Array Format in macros

    Hi ays_punk,
    try it
    Please Login or Register  to view this content.
    And also use the UserForm_Initialize instead of UserForm_Activate

  7. #7
    Registered User
    Join Date
    06-20-2013
    Location
    Jakarta, Indonesia
    MS-Off Ver
    Excel 2013
    Posts
    12

    Re: Konvert Row Range in excel to be Array Format in macros

    Thanks a lot Nilem, you make my complicated code being a simple one,
    It's work, you save my time

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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