Results 1 to 18 of 18

Grab data related to array code

Threaded View

  1. #1
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Grab data related to array code

    Hello everyone
    I have the following wonderful of HSV that enables me to transfer data across rows to columns
    Here's the attachment illustrating the expected results

    Sub MyReport()
        Dim SN, I As Long, J As Long, N As Long
        Sheets("Result").Range("A2:E1000").ClearContents
        SN = Sheets("Data").Range("H1:AU" & Sheets("Data").Cells(Rows.Count, 8).End(xlUp).Row)
        
        ReDim Arr(UBound(SN) * UBound(SN, 2), 2)
        For I = 2 To UBound(SN)
            For J = 1 To UBound(SN, 2) Step 2
                If SN(I, J) <> "" Then
                    Arr(N, 0) = SN(I, J)
                    Arr(N, 1) = SN(I, J + 1)
                    N = N + 1
                End If
            Next J
        Next I
        
        With Sheets("Result")
            .Cells(2, 4).Resize(N, 2) = Arr
        End With
    End Sub
    I can get results in sheets("Result") starting in range("D2")
    In Sheets("Result") Columns A & B & C I need to fill the data from Sheets("Data")
    The data which will be grabbed related to each row
    for example : the data Yasser1 to Yasser7 which is in row 2 related to the date : 01/06/2015 so in the sheets("Result") column A .. Range("A2:A8") is expected to that date
    The same with the "Branch Column" data >> will be in range("B2:B8") and "Sort Column" data >> will be in range("C2:C8")

    Hope it is clear

    Thanks advanced
    Attached Files Attached Files
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. VBA Code to grab data give critiria in textbox and output data range to cell range. Help!?
    By exclusiveicon in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-26-2014, 05:31 PM
  2. VB code for Excel to Open second spread sheet, grab data and close.
    By qi86@hotmail.co.uk in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-07-2014, 04:59 AM
  3. Need to pull data based on related code
    By MReitz in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-23-2011, 04:51 PM
  4. VBA code to populate data related to drop down list
    By ExcelGyan in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 10-04-2011, 03:32 AM
  5. [SOLVED] Need help on an issue related with code management & data dimension
    By J_J in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-22-2005, 09:06 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