Solved

Paste Values

Posted on 2011-02-22
2
234 Views
Last Modified: 2012-06-22
Hello,

Trying to build a macro to perform the following.  I have a macro with a variable: strData = Sheets("Control").Cells(18, 2).  What I need is the find a match of strData in Sheets("Control") column "M" and once a match is found take the value from Sheets("Outlook") cells AA3, AB3, AC3, AD3 AE3 and AF3 and place them in the matching row in column O for the value of AA3, column P for the value of AB3, Column Q for the value of AC3 and so on.
0
Comment
Question by:sandramac
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 42

Accepted Solution

by:
dlmille earned 500 total points
ID: 34958867
Ok, simple macro to search column M for data match at control sheet row 18 column 2.  Paste AA3->AF3 into matching row, but starting in column O.

Attached code functions as requested, below.

Also see attached worksheet demonstrating effectiveness.

Enjoy!

Dave
Sub FindMatchCopyPaste()
Dim strData As Range, rFound As Range

    Set strData = Sheets("Control").Cells(18, 2)
    
    On Error Resume Next
    With Sheets("Control")
        Set rFound = .Columns("M").Find(What:=strData.Value, After:=.Cells(1, "M"), LookIn:=xlValues, LookAt:= _
            xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
            , SearchFormat:=False)
    
        On Error GoTo 0
    
        If Not rFound Is Nothing Then
            Range(.Cells(rFound.Row, "O"), .Cells(rFound.Row, "T")).Value = Range([Outlook!AA3], [Outlook!AF3]).Value
        Else
            MsgBox "Item Not Found", vbOKOnly
        End If
    End With


End Sub

Open in new window

CopyPasteExercise-r1.xlsm
0
 

Author Closing Comment

by:sandramac
ID: 34975761
Thanks
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question