+ Reply to Thread
Results 1 to 3 of 3

Macro to search, sum and print values results in run time error 91

  1. #1
    Registered User
    Join Date
    11-29-2011
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    2

    Macro to search, sum and print values results in run time error 91

    Hello, I'm very new to using macros and also very new to this forum! I wondered if anyone could help me with a VBA macro that I'm a bit stuck with. I work as a researcher and I'm collecting data from an eye tracker, this generates a few thousand lines of code per person as I get a row of data every 16ms. As a result, I'd like to summarise the data into something that's slightly more manageable!

    I've been trying to adapt a macro written for a similar experiment but I'm pretty stuck as I can't see what's going wrong. The task involves people looking at images (six possibilities) and hearing a sentence. I have a workbook with a worksheet in that contains the words that are heard and the onset and offset times of each of the words. For each word that is heard in each sentence I want the macro to sum the amount of time spent looking at each area of interest (AOI) and print this with the following headings.

    Phrase= sentence heard
    Word_Playing= word playing from sentence
    Time_in_AOI= time spent looking at target AOI.
    AOI1_Pic= name of the picture at AOI1
    AOI1_Time= time spent looking at AOI1
    ...
    ...
    ...
    ..
    AOI6_Pic=name of the picture at AOI1
    AOI6_Time=time spent looking at AOI1
    Time_Not_Looking= time spent not looking

    As the code stands it runs and generate a new worksheet and the headings but that's about all. I keep getting a runtime 91 error, debugging says that this:
    Please Login or Register  to view this content.
    is the problem. Being so new to macros I'm not sure what this is line is achieving. This error ties in with the macro failing to find the AOI worksheet (a textbox appears stating this), I'm not sure why.

    I've attached my workbook and also my code (I've tried to comment as much as I could work out) as I think this might be helpful, I couldn't embed my code as it made this post too long.

    Does anyone have any idea how I might fix this as I'm a bit stuck and any help would be very gratefully received ? I'm keen to learn about macros but my Googling of the problems to date haven't been to helpful.

    Thank you,
    Kerry
    Attached Files Attached Files

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro to search, sum and print values results in run time error 91

    Hey Kerry,

    Welcome to the forum.
    Your attachments are not visible. Please attach again.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    11-29-2011
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Macro to search, sum and print values results in run time error 91

    Thank you for spotting this Arlette! I've hopefully now attached the relevant attachments. I've attached the Excel workbook that I'm using that contains the AOI information and some sample data (sheet3) as well as the macro as a separate text file (it's also within the workbook).

    Thank you,
    Kerry
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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