Results 1 to 8 of 8

Upload data to Specified columns in Closed Workbook - if name in column A matches

Threaded View

paula.mccall Upload data to Specified... 02-18-2020, 07:53 PM
jindon Re: Upload data to Specified... 02-19-2020, 09:38 PM
paula.mccall Re: Upload data to Specified... 02-19-2020, 11:19 PM
paula.mccall Re: Upload data to Specified... 02-21-2020, 08:47 PM
jindon Re: Upload data to Specified... 02-21-2020, 09:00 PM
paula.mccall Re: Upload data to Specified... 02-24-2020, 07:02 PM
jindon Re: Upload data to Specified... 02-24-2020, 11:20 PM
paula.mccall Re: Upload data to Specified... 02-25-2020, 02:15 PM
  1. #1
    Forum Contributor
    Join Date
    07-23-2019
    Location
    San Antonio, Texas
    MS-Off Ver
    Office 365
    Posts
    150

    Upload data to Specified columns in Closed Workbook - if name in column A matches

    Good evening.

    I am needing some help please. I have attached two separate workbooks ("Templates") --Monitoring Report and Analytical Data.

    1. I upload the analytical data to the Analytical Template (which does have formulas in columns C & E - S).

    What I need is:

    2. I need to copy the final data from columns B - S of the Analytical Data WB - ABC Stage WS
    and Paste that data (as numbers, not as formulas) to columns H - Z of the Monitoring Report WB - Treat Summary WS
    a. There may be data in columns B - G of the Monitoring Report, which will need to stay intact (as is)
    b. The pasted data will need to copy to the row that matches the names from column A of the Analytical Data to column A of the Monitoring Report.


    Example:
    Column A of the Monitoring Report - Treat Summary WS (beginning at Cell A9) has a list of 5 well names
    AAA-1, AAA-2, LuLu, 1-12 5WA, 1-12 3BS

    Column A of the Analytical Report - ABC Stage WS (beginning at Cell A2) has a list of 4 well names
    AAA-1, AAA-2, 1-12 5WA, 1-12 3BS

    I need the data from the AAA-1 data in the Analytical Report to upload the the row that has AAA-1 of the Monitoring Report


    I tried to write the following macro, but it is not running the way I had hoped:

    Sub Analytical()
    
    'Dim WM As Workbook
    
    Application.ScreenUpdating = False
    Application.Calculation = xlCalculationManual
    Dim srcWS As Worksheet, desWS As Worksheet, RngList As Object
    Dim LastRow As Long, bottomA As Long, Rng As Range
    Set srcWS = ThisWorkbook.Sheets("ABC Stage")
    LastRow = srcWS.Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
                    
                    
    Workbooks.Open "C:\Users\paulam\Documents\Monitoring Report_2020.T-1.xlsm"
    
    
    Set desWS = Sheets("Treat Summary") ''
    
    bottomA = desWS.Range("H" & desWS.Rows.Count).End(xlUp).Row
    
    desWS.Range("H9:Z" & bottomA).ClearContents
    
    Set RngList = CreateObject("Scripting.Dictionary")
    For Each Rng In srcWS.Range("A2:A" & LastRow)
        If Not RngList.Exists(Rng.Value) Then
            RngList.Add Rng.Value, Rng.Row
        End If
    Next Rng
    
    For Each Rng In desWS.Range("H9", desWS.Range("H" & desWS.Rows.Count).End(xlUp))
        If RngList.Exists(Rng.Value) Then
            Intersect(srcWS.Rows(RngList(Rng.Value)), srcWS.Range("B:B,C:C,D:D,E:E,F:F,G:G,H:H,I:I,J:J,K:K,L:L,M:M,N:N,O:O,P:P,Q:Q,R:R,S:S,T:T")).Copy
                    
        desWS.Cells(Rng.Row, 2).PasteSpecial xlPasteValues
        End If
    Next Rng
    RngList.RemoveAll
    LastRow = desWS.Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    
    
    For Each Rng In desWS.Range("A9:A" & bottomA)
    
        If Not RngList.Exists(Rng.Value) Then
            RngList.Add Rng.Value, Nothing
        End If
    Next Rng
    For Each Rng In srcWS.Range("A2", srcWS.Range("A" & srcWS.Rows.Count).End(xlUp))
        If Not RngList.Exists(Rng.Value) Then
    Intersect(srcWS.Rows(Rng.Row), srcWS.Range("A:A,B:B,C:C,D:D,E:E,F:F,G:G,H:H,I:I,J:J,K:K,L:L,M:M,N:N,O:O,P:P,Q:Q,R:R,S:S,T:T")).Copy
    
    desWS.Cells(desWS.Rows.Count, "A").End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
        End If
    Next Rng
        Application.Calculation = xlCalculationAutomatic
        Application.ScreenUpdating = True
    End Sub


    I appreciate your help and time in resolving this request.

    Kindest Regards,
    Paula
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. vba to copy specific columns with unique column records to a closed workbook
    By JEAN1972 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-11-2017, 01:00 AM
  2. Replies: 5
    Last Post: 02-10-2016, 02:20 PM
  3. Replies: 0
    Last Post: 03-27-2014, 12:38 PM
  4. Replies: 1
    Last Post: 09-26-2013, 12:16 PM
  5. Replies: 1
    Last Post: 09-26-2013, 11:32 AM
  6. Replies: 12
    Last Post: 07-03-2013, 01:35 PM
  7. Replies: 18
    Last Post: 12-13-2011, 10:15 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