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 7695621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:35:07+00:00 2026-05-31T21:35:07+00:00

I would like to know how to write a Macro to copy the value

  • 0

I would like to know how to write a Macro to copy the value of L3 up to L2 based on the fact that A2 and A3 are equal and B2 and B3 are also equal. Where subsequent rows of columns A and B are not equal the macro does not need to push data up. In some instances there may be as many as 10 subsequent rows where A & B column vales are equal and the oldest month value would need to roll right up to the top row where A & B match.

The entire sheet has about 150 rows with many City and Company values. I am currently performing this operation manually and it is time consuming. The purpose of the spreadsheet is to provide a sales visit summary based on data that is extracted out of our SQL based CRM package. Row 4 has no meaningful data is that context but it does not hurt if the data is rolled up Row 2 as long as all months with visits are represented on the top row where columns A & B match.

I’m guessing that the macro needs to loop through JAN (Column E) and complete that column and then loop through columns G through P sequentially after that. Only Columns E through P need to be manipulated. I don’t think it will have any negative consequences if the data is concatenated in the cells or just overwritten. Once the Macro is complete the top row for a given Company at a certain site should contain values in all of the months where it was visited.

My programming knowledge is limited but I can usually reverse engineer code enough to modify it if I get a good sample. I hope my request is clear.

  • 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-05-31T21:35:09+00:00Added an answer on May 31, 2026 at 9:35 pm

    Based on your first initial question “how to copy L3 to L2 if B2=B3 and A2=A3”, this basic macro will get you started along those lines:

    Option Explicit
    
    Sub CopyUP()
    Dim LR As Long, Rw As Long, col As Long
    
    LR = Range("A" & Rows.Count).End(xlUp).Row  'last row with data
    
    For Rw = LR To 2 Step -1                    'from the bottom up, compare
        If Range("A" & Rw) = Range("A" & Rw - 1) And _
           Range("B" & Rw) = Range("B" & Rw - 1) Then
    
            For col = 5 To 16       'columns E:P
                If Cells(Rw, col) <> "" Then Cells(Rw - 1, col) = Cells(Rw, col)
            Next col
    
        End If
    Next Rw
    
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to know how to write unit tests for a module that
I would like to know when I should include external scripts or write them
I would like to know how to write up the vbs code to schedule
As most of you know, in C/C++ I would write a macro similar to
I know that it's possible to write a register macro that will map their
I would like to know what's the difference when I write a temporary variable
I am new to Matlab. I would like to know how to write a
I would like to know how to write the following SQL query in Linq.
i know how to write MSIL code but out of curiosity i would like
I would like to know how to write a Linq (using lambda Expression in

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.