+ Reply to Thread
Results 1 to 5 of 5

Transfer a sub Table (column in a table) into VBA array

  1. #1
    Registered User
    Join Date
    12-04-2015
    Location
    Cairo,Egypt
    MS-Off Ver
    2013
    Posts
    6

    Question Transfer a sub Table (column in a table) into VBA array

    Hello,

    How do I transfer a column in a table into an array in vba ?

    as example my table is "Table2" , the sub table is [ES] , so I tried this and it didn't work:

    Please Login or Register  to view this content.
    and also tried this :

    Please Login or Register  to view this content.

    and one more question:

    why in the sub when I define mx=Worksheets("sheet1").Range("AB8").Value

    and then I enter the mx to a for loop as :

    Please Login or Register  to view this content.
    it doesn't work and say it must be constant ?!

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

    Re: Transfer a sub Table (column in a table) into VBA array

    try it
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    12-04-2015
    Location
    Cairo,Egypt
    MS-Off Ver
    2013
    Posts
    6

    Re: Transfer a sub Table (column in a table) into VBA array

    it didn't work :/

    look, here is the file and plz be patience with me because I've been doing this project for 2 weeks now and I have to submit it tomorrow, and I still have some calculations to make in it

    simply what i'm trying to do is :
    calculate the total labors/material/subcontractors cost in every month (after calculating the months)
    I have a total labors cost per activity and then the labor cost per day

    some activities are dependent and some are independent, so I have to know every activity starts when and ends when to know if the cost will enter this month

    now you have to look at the tst module

    and I don't mind looking at "Activity" userform and look into the "next" bottom code, coz after I've modified some text boxes the code crushes when ever I press next

    the attachment :

    Project test 2_3.xlsm
    Last edited by omarehabsalama; 12-12-2015 at 02:37 PM.

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

    Re: Transfer a sub Table (column in a table) into VBA array

    Hi Omar,
    it is very difficult to understand your problem completely
    But note that this expression EESS = Worksheets("Sheet1").Range("Table2[ES]").Value gives you a two-dimensional array (13 rows and 1 column), so your code should look something like this
    Please Login or Register  to view this content.
    instead of this
    Please Login or Register  to view this content.
    Hope it will help you a little bit

  5. #5
    Registered User
    Join Date
    12-04-2015
    Location
    Cairo,Egypt
    MS-Off Ver
    2013
    Posts
    6

    Re: Transfer a sub Table (column in a table) into VBA array

    ys it helped thx !!!

    I got over it actually by another mean

    I took the whole column like range("C:C")
    and that is one dimensional array , but a friend of mine told me that my problem would be trying to reference a 2 dim array as a 1 dim one, and u confirmed it

    so thanks again nilem

+ 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] Transfer current row of data (Table) to a new row in a second table on the same sheet
    By jrtraylor in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-12-2013, 11:12 PM
  2. [SOLVED] transfer data from one table to another table
    By pedjvak in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-31-2013, 04:24 AM
  3. Replies: 4
    Last Post: 01-18-2013, 10:49 PM
  4. UserForm to transfer items from one table to another table in the next empty cell...
    By aneese11 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-04-2012, 10:31 AM
  5. Transfer single column input data to fixed table in a separate Sheet
    By Prokis in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-07-2012, 05:37 AM
  6. macro to put zero's in table array - table array will vary in size each time
    By leanne2011 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-31-2012, 06:12 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