+ Reply to Thread
Results 1 to 10 of 10

data transfer through loop

  1. #1
    Registered User
    Join Date
    03-23-2015
    Location
    n/a
    MS-Off Ver
    2007
    Posts
    34

    Exclamation data transfer through loop

    i have this kind of data in excel file

    PHP Code: 
    Exportfile.xlsx

          A        B
    1
    )    Head  31-Dec-2017
    2
    )    a         23
    3
    )    b         45
    4
    )    c         46 
    Datasheet.xlsx

    And in datasheet data like this
    PHP Code: 
    1)           A
    2
    QUARTER          Data
    3
    31 Mar 2017  
    4
    30 Jun 2017  
    5
    30 Sep 2017  
    6
    31 Dec 2017  
    7
    )  
    8)  
    9)         B   
    10
    QUARTER          Data
    11
    31 Mar 2017 
    12
    30 Jun 2017 
    13
    30 Sep 2017 
    14
    31 Dec 2017 
    15

    16
    17)         C  
    18
    )QUARTER          Data
    19
    31 Mar 2017 
    20
    30 Jun 2017 
    21
    30 Sep 2017 
    22
    31 Dec 2017 

    now i want to paste values from exportfile to datasheet and want data like this

    PHP Code: 
    1)           
    2
    QUARTER          Data
    3
    31 Mar 2017  
    4
    30 Jun 2017  
    5
    30 Sep 2017  
    6
    31 Dec 2017         23
    7
    )  
    8)  
    9)         B  
    10
    QUARTER          Data
    11
    31 Mar 2017 
    12
    30 Jun 2017 
    13
    30 Sep 2017 
    14
    31 Dec 2017          45
    15

    16
    17)         C   
    18
    QUARTER          Data
    19
    31 Mar 2017 
    20
    30 Jun 2017 
    21
    30 Sep 2017 
    22
    31 Dec 2017          46 
    now i do this code

    PHP Code: 
    Sub copy_data(File_Name)
       For 
    2 To 4
    Windows
    ("Exportfile.xlsx").Activate
        Sheets
    ("ESheet").Select
             Cells
    (i2).Select
         Selection
    .Copy
    Windows
    (File_Name).Activate
        Sheets
    ("Dsheet").Select
       On Error Resume Next
      
    **'' here what i do** 
        
    Cells(j2).Select
       On Error Resume Next
        Selection
    .PasteSpecial Paste:=xlPasteValuesOperation:=xlNoneSkipBlanks _
            
    :=FalseTranspose:=False 
    Next
    End Sub
    now in above code on J line what should i do so values copy from export file and paste in datasheet in quarter 31 Dec 2017 through loop

    any solution ?
    Last edited by bakhtawar; 05-02-2018 at 01:36 AM.

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: data transfer through loop

    Assuming both workbooks are open.
    Run the code from "export.xlsx"
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    03-23-2015
    Location
    n/a
    MS-Off Ver
    2007
    Posts
    34

    Re: data transfer through loop

    you mean i run this code on OF sheet?

  4. #4
    Registered User
    Join Date
    03-23-2015
    Location
    n/a
    MS-Off Ver
    2007
    Posts
    34

    Re: data transfer through loop

    i want to code in OF sheet so when i run code on OF the values from export select and paste in OF file in E1 sheet in reserve column .. .

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: data transfer through loop

    Paste the code on to export.xlsx then run the code.

  6. #6
    Registered User
    Join Date
    03-23-2015
    Location
    n/a
    MS-Off Ver
    2007
    Posts
    34

    Re: data transfer through loop

    I did not understand why on export file .. ? because on other projects i did code on OF sheet ? i want to do code in OF sheet not on export file

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: data transfer through loop

    Then ignore my post.

  8. #8
    Registered User
    Join Date
    03-23-2015
    Location
    n/a
    MS-Off Ver
    2007
    Posts
    34

    Re: data transfer through loop

    will you please do the same code on sheet and then send me the sheet .. and secondly i try your code this shows an error

    check image

    Capture.PNG
    Last edited by bakhtawar; 05-02-2018 at 12:42 AM.

  9. #9
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: data transfer through loop

    I'm sending these messages from my phone and am too busy.

    will change the code later this afternoon.

  10. #10
    Registered User
    Join Date
    03-23-2015
    Location
    n/a
    MS-Off Ver
    2007
    Posts
    34

    Re: data transfer through loop

    chcek updated question

+ 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. Will using For Loop be faster for textbox value transfer to cells?
    By jp16 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-30-2018, 04:54 AM
  2. Transfer & confirm data transfer between workbooks
    By fenfool in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-02-2015, 01:10 PM
  3. Transfer Data from Mulitple worksheets to one summary sheet on a loop
    By GhostMoneky72 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-07-2014, 03:51 AM
  4. Transfer Rows to Other Sheets using a loop
    By trevor2524 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-18-2013, 04:31 AM
  5. [SOLVED] Match or Loop to Transfer Data from Userform to Sheet
    By cschoyer in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-25-2012, 03:06 PM
  6. Transfer Spreadsheet loop: Interior color changing
    By 02Pir8 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-18-2011, 03:40 PM
  7. [SOLVED] Copy the 14 cells and transfer them to another sheet loop
    By Crowbar via OfficeKB.com in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-09-2006, 01:25 AM

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