+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    07-15-2008
    Location
    Hyderabad
    Posts
    4

    Problem copying array values to worksheet cells

    Hi to all,

    I have a program where i need to assing array values to worksheet cells.The code is in Excel VBA.
    I don't why it is taking lot of time to update 1 row of data.
    When i checked the Taskmanager it is taking 50% of Excel.exe.


    The sample code is
    Code:
    With Worksheets("AAA")
        For intCnt = 1 To UBound(myarray)
            For intC = 1 To myrange.Columns.count
                Select Case myrange.Cells(1, intC)
                    Case "A"
                        .Cells(intR, intC).Value = intCnt
                    Case "B"
                        .Cells(intR, intC).Value = myarray(intCnt).ResName
                    Case "C"
                        .Cells(intR, intC).Value = myarray(intCnt).Weeknum
                End Select
            Next
            intR = intR + 1
        Next
     End With
    Please let me know how can i handle this in excel vba.
    Last edited by royUK; 07-15-2008 at 07:07 AM. Reason: clarity

  2. #2
    Forums Administrator royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    24,447
    As I said in my reply to your PM, please read the Forum Rules - you must use Code tags when posting code here.

    Have you set ll your variables & how?
    Last edited by royUK; 07-15-2008 at 07:10 AM.
    Hope that helps.

    RoyUK
    --------
    If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need

    For Excel consulting, free examples and tutorials visit Excel Consulting-Excel VBA
    Check out the free Excel Toolbar

    New members please read & follow the Forum Rules

    Remember to mark your questions Solved and rate the answer(s)


    Code Tags: Make your code easier for us to read

  3. #3
    Registered User
    Join Date
    07-15-2008
    Location
    Hyderabad
    Posts
    4
    I have declared a userdefined variable Type.
    There will be a set of Type values in my program.
    So i have used arrays to store it.

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.2.0