Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7884975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:56:35+00:00 2026-06-03T04:56:35+00:00

I know this has been done before, but I am running into an issue

  • 0

I know this has been done before, but I am running into an issue in where I want to change part of this script, I just don’t know how.

This is the code, below it is what I need to do.

Option Explicit

Sub PENCMR()
    Dim i As Integer

    With Application
        .ScreenUpdating = False
    End With

    'Internal NCMR
    Dim wsPE As Worksheet
    Dim wsNDA As Worksheet

    'Copy Ranges
    Dim c As Variant

    'Paste Ranges
    Dim p As Range

    'Setting Sheet
    Set wsPE = Sheets("Print-Edit NCMR")
    Set wsNDA = Sheets("NCMR Data")
    Set p = wsPE.Range("A54:U54")

    With wsPE
        c = Array(.Range("AG3"), .Range("B11"), .Range("B14"), .Range("B17"), .Range("B20"), .Range("B23") _
                , .Range("Q11"), .Range("Q14"), .Range("Q17"), .Range("Q20"), .Range("R25"), .Range("V23") _
                , .Range("V25"), .Range("V27"), .Range("B32"), .Range("B36"), .Range("B40"), .Range("B44") _
                , .Range("D49"), .Range("L49"), .Range("V49"))
    End With

    For i = LBound(c) To UBound(c)
        p(i + 1).Value = c(i).Value
    Next

    With wsNDA
        Dim rFind As Long, NR As Long, LR As Long, LC As Long
        LR = .Range("C" & Rows.Count).End(xlUp).Row
        LC = .Cells(2, Columns.Count).End(xlToLeft).Column
        NR = LR + 1
        rFind = wsNDA.Range("A3:A" & LR).Find(wsPE.Range("A54:U54")).Row

        .Range("A54", .Cells(2, LC)).Copy
        .Range("A" & rFind).PasteSpecial xlPasteValues
        .Range("A54", .Cells(1, LC)).ClearContents
    End With

    With Application
        .ScreenUpdating = True
    End With
End Sub

The script is meant to do this:

When the code is activated, it is meant to copy all cells and then paste them into a row below the form and then after referencing the 2nd page comparing the first cell of the newly created row to the 2nd page list copy and replace the information.

What I’d like to see, since I’ve been told that it can be done without pasting onto the same page, is copy the data, do a search for the ID number on the 2nd sheet, and paste over said row with the new data.

Here is the sheet:

Excel Replace WkSht

The way this is written now, it doesn’t replace the information, it just overwrites it with blank information. Which I’ve yet to figure out why… hopefully with this request rewrite, I’ll be able to get that resolved.

Thanks again for the help. This place has been amazing in what they have done so far in helping me not only learn, but to write smartly in the long run.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T04:56:36+00:00Added an answer on June 3, 2026 at 4:56 am

    Some suggested changes:

    Sub PENCMR()
        Dim i As Integer
    
        'Internal NCMR
        Dim wsPE As Worksheet
        Dim wsNDA As Worksheet
        Dim c As Variant 'Copy Ranges
        Dim p As Range 'Paste Ranges
    
        Application.ScreenUpdating = False
    
        'Setting Sheet
        Set wsPE = Sheets("Print-Edit NCMR")
        Set p = wsPE.Range("A54:U54")
    
        Set wsNDA = Sheets("NCMR Data")
    
        c = Array("AG3", "B11", "B14", "B17", "B20", "B23" _
                , "Q11", "Q14", "Q17", "Q20", "R25", "V23" _
                , "V25", "V27", "B32", "B36", "B40", "B44" _
                , "D49", "L49", "V49")
    
        For i = LBound(c) To UBound(c)
            p(i + 1).Value = wsPE.Range(c(i)).Value
        Next
    
        With wsNDA
            Dim NR As Long, LR As Long, LC As Long
            Dim f As Range
    
            LR = .Range("C" & Rows.Count).End(xlUp).Row
            LC = .Cells(2, Columns.Count).End(xlToLeft).Column
            NR = LR + 1
    
            'find matching row if it exists
            Set f = .Range("A3:A" & LR).Find(what:=p.Cells(1).Value, LookIn:=xlValues, lookat:=xlWhole)
            If Not f Is Nothing Then
                f.Resize(1, p.Cells.Count).Value = p.Value
            Else
                'what should happen if not found?
            End If
        End With
    
        Application.ScreenUpdating = True
    
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this has been done a thousand times before but I'm having trouble
I know this has been done many times before (some posts are really old
I know this question has been done but I have a slightly different twist
I know this has been asked different ways several times, but I'm just not
I know this has been asked thousands of times but I just can't find
I know this has been asked many times before, but i still can't seem
I know this has been asked before but all the answers I found didn't
I know this has been asked much the same before but no answers seem
I don't know if this has been asked before, but we're having a discussion
Ok, I know this has been asked a thousand times before, but no conclusive

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.