+ Reply to Thread
Page 2 of 2 FirstFirst 12
Results 16 to 18 of 18

Thread: Macro help to copy row from one spreadsheet to another

  1. #16
    Forum Guru
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2003, 2007.
    Posts
    1,462

    Re: Macro help to copy row from one spreadsheet to another

    sfoxbox,

    Based on your latest request, and your Private Message, try the following.


    Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).


    
    Option Explicit
    Sub GetIncompleteV4()
    ' stanleydgromjr, 01/24/2012
    ' http://www.excelforum.com/excel-programming/809567-macro-help-to-copy-row-from-one-spreadsheet-to-another.html
    Dim wF As Worksheet, wP As Worksheet, wE As Worksheet
    Dim c As Range, firstaddress As String, lr As Long, nr As Long
    Application.ScreenUpdating = False
    Set wF = Worksheets("Full Report")
    Set wP = Worksheets("Prioritized Report")
    Set wE = Worksheets("Executive Summary")
    wF.Range("A1:J7").Copy wP.Range("A1")
    wF.Range("A1:E3").Copy wE.Range("A1")
    lr = wP.Cells(Rows.Count, "D").End(xlUp).Row
    If lr > 7 Then wP.Range("A8:J" & lr).Clear
    nr = 8
    With wF.Columns(4)
      Set c = .Find("No", LookIn:=xlValues, LookAt:=xlWhole)
      If Not c Is Nothing Then
        firstaddress = c.Address
        Do
          wF.Rows(c.Row).Copy wP.Range("A" & nr)
          nr = wP.Range("D" & Rows.Count).End(xlUp).Offset(1).Row
          Set c = .FindNext(c)
        Loop While Not c Is Nothing And c.Address <> firstaddress
      End If
    End With
    wP.Activate
    Application.ScreenUpdating = True
    End Sub

    Before you use the macro with Excel 2007 or newer, save your workbook, Save As, a macro enabled workbook with the file extension .xlsm


    Then run the GetIncompleteV4 macro.
    Have a great day,
    Stan
    stanleydgromjr
    Windows Vista Business, Excel 2003 and 2007

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  2. #17
    Registered User
    Join Date
    12-24-2011
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Macro help to copy row from one spreadsheet to another

    Hey Stan, I sent you an email but not sure if it went through. You are correct about the executive summary sheet in the workbook. I only need A1:E3 on the full report sheet to copy to this sheet. As for your last question, just want to macro to copy the data once no matter how many times the macro is ran. That is the way it is performing right now, just don't want to loose this. Sorry if this is confusing. Thanks for your help. Scott

  3. #18
    Registered User
    Join Date
    12-24-2011
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Macro help to copy row from one spreadsheet to another

    Once again Stan, you are the man! Works great. Thanks for you help!

  4. #19
    Forum Guru
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2003, 2007.
    Posts
    1,462

    Re: Macro help to copy row from one spreadsheet to another

    sfoxbox,

    Thanks for the feedback.

    You are very welcome. Glad I could help.

    Come back anytime.
    Have a great day,
    Stan
    stanleydgromjr
    Windows Vista Business, Excel 2003 and 2007

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

+ 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.2.0