+ Reply to Thread
Results 1 to 5 of 5

Average Coding in VBA

  1. #1
    Registered User
    Join Date
    02-15-2012
    Location
    Lynchburg, Virginia
    MS-Off Ver
    Excel 2007
    Posts
    32

    Average Coding in VBA

    Hey guys,

    So what I'm trying to do is condense a bunch of data into a smaller file. I need to take an average of the data over every three minutes and associate it with other data. I was able to write a working code that allowed me to accomplish this but what i'd like to do is have it prompt me for a number of minutes and use the number I type in to determine the range over which to take the average. Here's what I have before.

    Please Login or Register  to view this content.
    and here's what I'd like to do

    Please Login or Register  to view this content.
    Only I don't know the coding to accomplish that. Any ideas?
    Last edited by ParkerExcel; 02-28-2012 at 11:03 AM.

  2. #2
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Average Coding in VBA

    Please use code tags when posting code to the forum per the forum rules.

    3. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Select your code and click the [#] button at the top of the post window (if you are editing an existing post, press Go Advanced to see the [#] button).
    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  3. #3
    Valued Forum Contributor
    Join Date
    12-16-2004
    Location
    Canada, Quebec
    Posts
    363

    Re: Average Coding in VBA

    Did you try something like this
    Please Login or Register  to view this content.
    Denis

    Please always attach the sample workbook without sensitive information when asking for help

    To add a module
    Press Alt + F11 (this is the Visual Basic Environment)
    Insert Menu, select Module
    Past code there
    Close Visual Basic Environment (X)

  4. #4
    Registered User
    Join Date
    02-15-2012
    Location
    Lynchburg, Virginia
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Average Coding in VBA

    Good Idea, Denis, but it was a no go. It came up with run-time error "1004"; Application or object denfined error.

  5. #5
    Valued Forum Contributor
    Join Date
    12-16-2004
    Location
    Canada, Quebec
    Posts
    363

    Re: Average Coding in VBA

    Hi Parker

    The only difference I could see is
    Minutes the first one was recorded at -1399
    Please Login or Register  to view this content.
    The new minutes if 3 minutes
    minutes=-1439
    Please Login or Register  to view this content.
    Your best bet is to attached(spreadsheet) a sample of what you want done

+ 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