Results 1 to 7 of 7

Nested Loop does not transfer value of each cell in Range to another worksheet!

Threaded View

  1. #1
    Registered User
    Join Date
    04-24-2019
    Location
    Bogota,Colombia
    MS-Off Ver
    2013
    Posts
    48

    Nested Loop does not transfer value of each cell in Range to another worksheet!

    Hi everyone,

    I wrote a nested loop to transfer the values of each cell in a named range to another worksheet in the same workbook. However, it transfers only the value of the first cell in the range to the assigned cell in the recipient sheet. I have tried anything I could thing of such as defining the range as object instead of range but nothing works. Any help would be much appreciated!

    The code should transfer the data from the named range "FPlannerM1" to the first available row in "ToSheet" in only one row, example A2 B2 C2 D2 etc, when the info in the range is changed, then the macro should do the same on; A3 B3 D3 and so on.

    Sub mcrSaveRecord()
    
    Dim RowFPArch As Range
    Dim ItemC As Range
    Dim i As Long
    Dim Counter As Long
    
    Set RowFPArch = Worksheets("FinancialPlanner").Range("FPlannerM1")
    Counter = Worksheets("FinancialPlanner").Range("FPlannerM1").Count
    
     Sheets("FPArch").Select
        Range("A1048576").Select
        Selection.End(xlUp).Select
    
    For Each ItemC In RowFPArch
       For i = 0 To (Counter - 1)
            ActiveCell.Offset(1, i).Range("A1").Value = RowFPArch.Cells.Value
    Next i
      Next
      
    ActiveCell.Offset(1, 0).Range("A1").Select
    
    End Sub
    Attached Files Attached Files
    Last edited by realbestpete; 04-29-2019 at 11:28 PM. Reason: I attached a file

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 3
    Last Post: 01-09-2017, 05:22 PM
  2. Nested For Each loop for 2 range variables
    By artur.serra in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-03-2013, 10:34 AM
  3. [SOLVED] nested loop for copying range: error no cells were found
    By Edejager in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-09-2013, 08:52 AM
  4. [SOLVED] Can't get nested Loop to copy range values from 2 tables working correctly
    By gtol in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-05-2013, 12:01 PM
  5. [SOLVED] Problems with nested loop to copy a range
    By Edejager in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-04-2013, 10:40 AM
  6. Next without For error in nested loop - Escaping a Nested Loop?
    By BeneRich in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-10-2012, 06:38 PM
  7. For each loop nested; getting stuck on one cell in first iteration of nested loop
    By Excel_vba in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-22-2009, 11:54 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