+ Reply to Thread
Results 1 to 3 of 3

vba to manipulate range

  1. #1
    Registered User
    Join Date
    06-22-2010
    Location
    ontario
    MS-Off Ver
    Excel 2007
    Posts
    16

    vba to manipulate range

    Hello,
    I want to transpose and invert a source range composed from 6 rows and 10 columns.
    There is an attached picture, that represent my goal.

    i wrote this code in vba :

    Sub att11()

    Dim inRng As Range
    Set inRng = Sheets("dQP").Range("_A")


    Dim Xin As Variant
    Dim Xout As Variant

    Xin = inRng.Value

    ReDim Xin(6, 10)
    ReDim Xout(10, 6)

    For i = 0 To UBound(Xin, 2)

    For j = 0 To UBound(Xin, 1)

    Xout(i, j) = Xin(UBound(Xin, 1) - j, i)

    Next j
    Next i

    Debug.Print Xout(1, 1)

    End Sub

    AND,
    i dont understand why Xout is empty.
    when i call some value from within it, the result is always nothing.


    Can someone help me please?
    thanks a lot
    Attached Images Attached Images

  2. #2
    Valued Forum Contributor
    Join Date
    06-17-2009
    Location
    Chennai,India
    MS-Off Ver
    Excel 2003,excel 2007
    Posts
    678

    Re: vba to manipulate range

    suppose in sheet 1 data from A1 to B3 is as follows


    A D
    B E
    C F

    copy this data in sheet 2 also
    first experiment with this sample data.
    now run the macro "test"
    If you want to recheck run first "undo" and then run "test"

    I am sure you can modify the macro to suit you.

    the macros are

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

  3. #3
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: vba to manipulate range

    suppose the region begins in cel A1:

    Please Login or Register  to view this content.
    Last edited by snb; 08-07-2010 at 04:32 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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