+ Reply to Thread
Results 1 to 1 of 1

Cannot get code to not be nothing after .Find

  1. #1
    Registered User
    Join Date
    12-08-2020
    Location
    United States
    MS-Off Ver
    2011
    Posts
    6

    Cannot get code to not be nothing after .Find

    I am trying to code a macro that will take an ID number that is somewhere in the file name and then find the matching subject number in Column A of a master sheet, where it will then offset and add to that row. There are two files, one called InterviewData10**.xlsx and SCIDdata10**.xslx with the asteriks representing two numbers. I had success with InterviewData using this code:


    Please Login or Register  to view this content.

    I tried this with the SCIDdata, however it is a lot more conditional than just copying and pasting. It has 1's that when in certain cells need to have a certain word put into the master file. This is the code I am trying to use:


    Please Login or Register  to view this content.

    When running the code is stopped when I do SubjectID.Offset.

    In my efforts to debug, I have found the following:

    The file is certainly opening, and data can be copied and pasted.

    The mid function is grabbing the correct subject ID number from the name of the file.

    It is not "nothing" because if I do simple functions (that do not involve SubjectID) after the first if statement, there is no error and the code will run properly.

    When doing debug.Print, for some reason there is nothing in the immediate window. It does not recognize the SubjectID as a cell value, whereas when I do debug.Print on the SubID from InterviewData, it comes up with the ID number for the chosen file. Because of this, it is telling me that I am missing an object (error 91).

    I am aware of the problem, but I have no idea how to fix it.
    Last edited by hamsterpopcorn; 12-09-2020 at 08:11 PM.

+ 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. Replies: 1
    Last Post: 02-26-2020, 07:59 PM
  2. VBA code to find the code in both Payer and receiver and do concontate
    By julielara in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-04-2016, 01:59 AM
  3. Replies: 6
    Last Post: 02-21-2016, 04:15 AM
  4. Find and Display results VBA Code - Loop to find all Matches
    By i2rule in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-16-2014, 03:14 PM
  5. [SOLVED] How to code the selection.find not to crash when the data to find is blank
    By evertjvr in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 05-25-2012, 03:04 PM
  6. trouble with vba code for Find, Insert copied cells and find next
    By jgelbach in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-26-2012, 01:45 PM
  7. code to find, copy and paste until find new, then repeat
    By siddharthariver in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-12-2010, 04:02 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