Solved

Paste Values

Posted on 2011-02-22
2
230 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
2 Comments
 
LVL 41

Accepted Solution

by:
dlmille earned 500 total points
Comment Utility
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
Comment Utility
Thanks
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

INDEX and MATCH can be used to great effect to replace HLOOKUP and VLOOKUP as it does not have the limitation of needing the data to be sorted so that the reference value is in the first column or row. It also has the ability to perform a bi-directi…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now