Results 1 to 2 of 2

Compare cell in one file to same cell in another file, continue macro only if cells match

Threaded View

CherylC Compare cell in one file to... 02-24-2014, 09:26 PM
TMS Re: Compare cell in one file... 02-24-2014, 09:31 PM
  1. #1
    Registered User
    Join Date
    12-03-2012
    Location
    Indianapolis, IN
    MS-Off Ver
    Excel 2010
    Posts
    8

    Compare cell in one file to same cell in another file, continue macro only if cells match

    I have a master workbook that I use to accumulate responses. Each worksheet represents a different customer. The customer worksheets are then exported to separate files to gather information. Once customer data is gathered, it is then copied back into the master workbook. I have a macro on each worksheet within the master file that allows the user to first select a file to copy data from and then certain data is then copied back into the master workbook on the worksheet in which the macro was executed from. I want to add a piece to that macro that will check to make sure the customer number on the file that the user selects to copy from matches the customer number on the worksheet that they executed the macro from, i.e. it will copy the right customer's information onto the right customer's worksheet in the master workbook.

    Here is my basic Open/Copy/Paste macro:

    Sub CopyResponseBackIntoMASTER()
    Dim wst As Worksheet
    Dim CommentFile As String
    
    Set wst = ActiveSheet
    MsgBox ("Please select a file to copy comments from.")
    CommentFile = Application.GetOpenFilename("Excel Files(*.xls; *.xlsx; *.xlsm), *.xls; *.xlsx; *.xlsm", 1, "Select One File To Open", , False)
    If CommentFile <> "False" Then
    Workbooks.Open CommentFile
    Range("F17:G90").Copy
    wst.Range("F17").PasteSpecial xlPasteValues
    Application.CutCopyMode = False
    ActiveWorkbook.Close False
    End If
    
    End Sub
    Last edited by arlu1201; 02-27-2014 at 07:15 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Need to take the value of one cell in one file, and match/delete a row in another file.
    By Chezman2000 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-24-2013, 03:39 PM
  2. Save as macro that specifies file type, file location and takes file name from three cells
    By ExcelFailure in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 06-13-2013, 10:09 PM
  3. [SOLVED] macro to save file to specific folder with file name from cell reference
    By mezza89 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-06-2013, 11:32 AM
  4. Macro to Compare Two sheets, if Match *within* Cell then Update another Cell
    By karimifarzan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-12-2013, 03:05 PM
  5. Replies: 6
    Last Post: 05-30-2012, 03:09 PM

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