+ Reply to Thread
Results 1 to 20 of 20

relationship table

  1. #1
    Registered User
    Join Date
    03-23-2011
    Location
    Bangalore
    MS-Off Ver
    Excel 2003
    Posts
    24

    relationship table

    Hi All,
    Again I came up with a new tricky copy past problem...and I hope my problem will be resolved here...
    Need a VBA code for belwo issue...

    Please Open attached sheet...
    In attached sheet I have to copy three columns data from "Source" into "Destination" sheet but only as per given format (tabular form)(Same format I given in "Destination" sheet)
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: relationship table

    hi pankaj8219, basing on the sample file provided it could be done this way, press "Run" button or run code "test"
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    03-23-2011
    Location
    Bangalore
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: relationship table

    Hi watersev....
    its wonderful...how quickly all the myth solved...Thank You So much...

    one small issue....after clicking on run button every time a new sheet is created, but its not require...

    I want to make relationship table only on Destination sheet

  4. #4
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: relationship table

    please check attachment
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: relationship table

    the code is updated to collapse outline levels before processing data otherwise the code would not work
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    03-23-2011
    Location
    Bangalore
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: relationship table

    Thanks but now I am getting subscript out of range error on the line " result(3, j) = arr(I, 3)"

    One mistake: In source tab my columns are "C","D",and"E"

  7. #7
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: relationship table

    please check attachment
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    03-23-2011
    Location
    Bangalore
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: relationship table

    Thanks but now I am getting subscript out of range error on the line " result(3, j) = arr(I, 3)"

    One mistake: In source tab my columns are "C","D",and"E"

  9. #9
    Registered User
    Join Date
    03-23-2011
    Location
    Bangalore
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: relationship table

    Thanks a lot:
    but now I am getting subscript out of range error on the line " result(3, j) = arr(I, 3)"

    One mistake: I given the wrong format of Source tab...actually I want to make unique for first and second column...

    Please see in attached new workbook "Book3(1).xls"
    Attached Files Attached Files

  10. #10
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: relationship table

    please check attachment, press "Run" button or run code "test"
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    03-23-2011
    Location
    Bangalore
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: relationship table

    again getting error as Subscript Out of Range on ("arr(i + 1, 3)" in the line "If arr(i, 3) = "" And arr(i + 1, 3) <> "" Then", for the last item in column E

    getting hard to debug it...

    Please help

  12. #12
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: relationship table

    the code works on the sample file as required without errors

  13. #13
    Registered User
    Join Date
    03-23-2011
    Location
    Bangalore
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: relationship table

    yes...its fine on sample file...but when I placed it in original file...then getting error....data format is same for both....dont know why this error occuring...

  14. #14
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: relationship table

    because data format is not the same

  15. #15
    Registered User
    Join Date
    03-23-2011
    Location
    Bangalore
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: relationship table

    I checked with formatting all the columns (C,D,E) as general as well as text...but problem is still same....give some more debugging steps please

  16. #16
    Registered User
    Join Date
    03-23-2011
    Location
    Bangalore
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: relationship table

    Hi...
    If I replace the arr value as fixed range then code is working
    'arr = mainsh.Range("c11:e" & lrow)
    arr = mainsh.Range("C11:E70")

    for less then E70 its giving same error "Subscript Out of range", even if my last row is 58....

  17. #17
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: relationship table

    post original data file

  18. #18
    Registered User
    Join Date
    03-23-2011
    Location
    Bangalore
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: relationship table

    Hi
    Here attached is the original data
    Attached Files Attached Files

  19. #19
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: relationship table

    please check attachment
    Attached Files Attached Files

  20. #20
    Registered User
    Join Date
    03-23-2011
    Location
    Bangalore
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: relationship table

    Thanks a lot for your effort and time...it working...

    I hope in some days I will make myself familiar with these type of array coding...

+ 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