+ Reply to Thread
Results 1 to 7 of 7

Allocate array with values from different ws

  1. #1
    Forum Contributor
    Join Date
    01-28-2013
    Location
    sweden
    MS-Off Ver
    Excel 2010
    Posts
    108

    Allocate array with values from different ws

    I am trying to allocate an array with values from a worksheet in my workbook.

    Sheet in question is a variable named CurWs and I have expected value in Watches window but this line of code throws me an error.

    Please Login or Register  to view this content.
    Have I specified range wrong?

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: Allocate array with values from different ws

    Deleted code
    Last edited by AlphaFrog; 12-23-2016 at 07:57 AM.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: Allocate array with values from different ws

    Try this...

    Please Login or Register  to view this content.
    Or this...
    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    01-28-2013
    Location
    sweden
    MS-Off Ver
    Excel 2010
    Posts
    108

    Re: Allocate array with values from different ws

    Problem is that I set CurWs in a private sub. But I have made it global by

    Please Login or Register  to view this content.
    In a module.

    When I run private sub CurWs is assigned value but gets value <out of context> when private sub is finished.

    Please Login or Register  to view this content.
    Can you see why CurWs isnt global with this code?

  5. #5
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: Allocate array with values from different ws

    You are using two different variables.

    You declared the public variable CurWs

    The code sets the worksheet to CurrentWs

  6. #6
    Forum Contributor
    Join Date
    01-28-2013
    Location
    sweden
    MS-Off Ver
    Excel 2010
    Posts
    108

    Re: Allocate array with values from different ws

    mon dieu..

  7. #7
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: Allocate array with values from different ws

    De rien .

+ 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: 2
    Last Post: 03-06-2016, 09:22 PM
  2. Replies: 2
    Last Post: 03-06-2016, 11:05 AM
  3. Replies: 3
    Last Post: 03-06-2016, 11:02 AM
  4. Replies: 2
    Last Post: 03-06-2016, 11:02 AM
  5. Array function to allocate total across accounts based on prioritization
    By lpcapital in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 10-29-2013, 04:56 PM
  6. [SOLVED] Using identifiers to allocate values into seperate sums
    By Frantelle in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-11-2012, 10:59 AM
  7. allocate values to specific rows
    By furor in forum Excel General
    Replies: 7
    Last Post: 07-06-2011, 07:07 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