Solved

Paste Values

Posted on 2011-02-22
2
235 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

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
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;…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

707 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