+ Reply to Thread
Results 1 to 8 of 8

Issues with Pasting Unique Text into Find Field in Macro

  1. #1
    Registered User
    Join Date
    12-23-2019
    Location
    Washington DC
    MS-Off Ver
    2016
    Posts
    4

    Issues with Pasting Unique Text into Find Field in Macro

    To boil this down as best I can, I have 2 separate workbooks. I have copied the 2 columns of data from Workbook 2 into sheet 2 of Workbook 1. I used the search function in the best manner I could. No one seemed to have the specific issue I am having atm. It is very possible I searched for the wrong terms, so if a post does exist with my specific issue, please lmk.

    What I have tried to do with the below Macro is the following:

    - The value of Column A on Sheet 1 matches a value in Column G of sheet 2.
    - On Sheet 2, the value of Column H that corresponds with the matching value found on Sheet 2 I want to be copied/pasted, inserted, linked, mirrored (etc.) into Column B of sheet 1.

    I added a Do While loop into the macro to run down through the list until it reaches an empty row, but the problem I'm running into is the Find function needs an explicit value (i.e. "Sample"). I cannot seem to locate a proper replacement such as "ActiveSheet.Paste" to insert the copied date into the Find searchbox.

    Am I going about this the wrong way? Should I scrap the code I've made for something completely different?

    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor
    Join Date
    04-24-2014
    Location
    United States
    MS-Off Ver
    Office 365 ProPlus
    Posts
    853

    Re: Issues with Pasting Unique Text into Find Field in Macro

    Can you post a sample file? If I understand correctly, you may not need VBA for this, and could possible use an Index Match formula to get the value you want.

  3. #3
    Registered User
    Join Date
    12-23-2019
    Location
    Washington DC
    MS-Off Ver
    2016
    Posts
    4

    Re: Issues with Pasting Unique Text into Find Field in Macro

    Really? I tried using Vlookup, but only was able to pull a TRUE/FALSE issue. I've attached a crude layout of something just to kind of represent what I'm looking to accomplish here.

    On sheet 1, column A has a blank country cell. On Sheet 2, column D has the corresponding country.

    The match can be made with finding the duplicated values of the "Net $" columns on both sheets, and I want to pull the country name from the 2nd sheet and place it into column A of the first sheet.

    If a formula can do that, I'd love to hear back.
    Attached Files Attached Files
    Last edited by averagejoe365; 12-25-2019 at 08:28 PM. Reason: Forgot to attach file with sample data

  4. #4
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,521

    Re: Issues with Pasting Unique Text into Find Field in Macro

    Try pasting the following into cell A3 on sheet 1: =IFERROR(INDEX('Sheet 2'!A$3:A$11,MATCH(C3,'Sheet 2'!B$3:B$11,0)),"")
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  5. #5
    Registered User
    Join Date
    12-23-2019
    Location
    Washington DC
    MS-Off Ver
    2016
    Posts
    4

    Re: Issues with Pasting Unique Text into Find Field in Macro

    Quote Originally Posted by JeteMc View Post
    Try pasting the following into cell A3 on sheet 1: =IFERROR(INDEX('Sheet 2'!A$3:A$11,MATCH(C3,'Sheet 2'!B$3:B$11,0)),"")
    Let us know if you have any questions.
    Took a little time modifying the function to adapt to what I needed, but this performed excellently!

    Is there a chance that it can return "N/A" or something if it doesn't find the value? Currently, it only leaves a blank cel which works if not.

    Either way, thanks again for this! It helps out extremely!

  6. #6
    Valued Forum Contributor
    Join Date
    04-24-2014
    Location
    United States
    MS-Off Ver
    Office 365 ProPlus
    Posts
    853

    Re: Issues with Pasting Unique Text into Find Field in Macro

    Quote Originally Posted by averagejoe365 View Post
    Is there a chance that it can return "N/A" or something if it doesn't find the value? Currently, it only leaves a blank cel which works if not.

    You may have already figured it out, but yes just change the ending quotes at the end for the formula from "" to "N/A"

  7. #7
    Registered User
    Join Date
    12-23-2019
    Location
    Washington DC
    MS-Off Ver
    2016
    Posts
    4

    Re: Issues with Pasting Unique Text into Find Field in Macro

    Quote Originally Posted by ptmuldoon View Post
    You may have already figured it out, but yes just change the ending quotes at the end for the formula from "" to "N/A"
    Yes, I figured it out after messing with it again for a little while. Thanks again for the quick response!

  8. #8
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,521

    Re: Issues with Pasting Unique Text into Find Field in Macro

    You're Welcome and thank you for the feedback. Please take a moment to mark the thread as 'Solved' using the thread tools menu above your first post. I hope that you have a blessed day.
    @ptmuldoon, thank you for your help. I hope that you have a blessed day also.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Pasting text from Lotus Notes / Outlook into a userform only pastes the To: field.
    By BellyGas in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-21-2017, 06:04 AM
  2. Find and Replace text issues - need vb code
    By awhittkle23 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-04-2016, 05:32 PM
  3. COUNTIF to find # of unique values per field.
    By angeleenmc in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-15-2015, 05:44 PM
  4. [SOLVED] How to change find formula from single text field to more than one text field
    By cmwilbur in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-11-2015, 04:13 PM
  5. [SOLVED] Find unique field in one column and extract data in previous columns
    By Waqaskp in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 09-18-2013, 01:01 AM
  6. Replies: 3
    Last Post: 05-03-2010, 11:23 AM
  7. Issues pasting in column B and making 2nd macro available
    By sungsam in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-13-2008, 07:03 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1