Closed Thread
Results 1 to 10 of 10

macro uploaded, but how do I use it?

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    11-10-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    260

    macro uploaded, but how do I use it?

    Hello,

    I have this spreadsheet attached , and I was given a macro to calculate an average speed, on column M
    Screenshot - 10_17_2017 , 10_50_53 AM.png
    I have uploaded the macro
    Screenshot - 10_17_2017 , 10_51_12 AM.png

    But how to know that it will work? how do I make it work?

    Any input is welcome, many thanks!
    Alex

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: macro uploaded, but how do I use it?

    There are two types of programming in VBA: Functions and Procedures.
    A function usually return a value like sum function in excel.
    A procedure does not return a value, but execute a code- it does something.
    You have procedure, so you have to run it to get the code executed. You need to go in to the module by clicking the visual editor button and while you are inside the module you press F5 or click the run button at the top of the window.

    You can attach the code to a button. When you press the button the code runs.
    How do you know the code runs? Well, if you do not get an error, it means the code run successfully , but it does not necessarily mean the code is right.
    I can not run and test the code as you have another procedure attached to the code-wkbkName = frmSelectWorkbook.SelectWorkbook. I other words, the code can not run as it is now as part of it is missing.
    Last edited by AB33; 10-17-2017 at 05:27 AM.

  3. #3
    Forum Contributor
    Join Date
    11-10-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    260

    Re: macro uploaded, but how do I use it?

    Quote Originally Posted by AB33 View Post
    There are two types of programming in VBA: Functions and Procedures.
    A function usually return a value like sum function in excel.
    A procedure does not return a value, but execute a code- it does something.
    You have procedure, so you have to run it to get the code executed. You need to go in to the module by clicking the visual editor button and while you are inside the module you press F5 or click the run button at the top of the window.

    You can attach the code to a button. When you press the button the code runs.
    How do you know the code runs? Well, if you do not get an error, it means the code run successfully , but it does not necessarily mean the code is right.
    I can not run and test the code as you have another procedure attached to the code-wkbkName = frmSelectWorkbook.SelectWorkbook. I other words, the code can not run as it is now as part of it is missing.
    Thanks AB33, something is not right, I need a little more guidance:

    so i have my average speed in modules
    Screenshot - 17_10_2017 , 11_14_30.png
    I press F5 and get ready to run the macro...
    Screenshot - 17_10_2017 , 11_14_58.png
    I get this error
    Screenshot - 17_10_2017 , 11_15_08.png
    and this is from the debug....
    Screenshot - 17_10_2017 , 11_15_21.png

    what's the problem?

    you said you cannot run and test the code as I have another procedure attached to the code-wkbkName = frmSelectWorkbook.SelectWorkbook.
    and that the code can not run as it is now as part of it is missing. ... so you are saying that part of the macro code I attempt to apply
    is missing? how do you know?

  4. #4
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,329

    Re: macro uploaded, but how do I use it?

    This way the code runs. It creates a new column X with results.
    Wether these are correct that's for you to review.
    Attached Files Attached Files
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  5. #5
    Forum Contributor
    Join Date
    11-10-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    260

    Re: macro uploaded, but how do I use it?

    Quote Originally Posted by bakerman2 View Post
    This way the code runs. It creates a new column X with results.
    Wether these are correct that's for you to review.
    Ok it worked in that specific spreadhseet. I don't know what you did to it, but then it won't apply to other spreadsheet... sorry, this is trivial I know, just don't understand how to make it work to another spreadhseet?

    Screenshot - 17_10_2017 , 11_47_31.png
    I run it, it asks to chose the spreadsheet, i chose a new one
    Screenshot - 17_10_2017 , 11_47_45.png
    error
    Screenshot - 17_10_2017 , 11_47_52.png
    debug
    Screenshot - 17_10_2017 , 11_48_00.png

    I need to know how to make this work on other spreadhseets as well, besides in the one that you attached.

    many thanks!
    Alex

  6. #6
    Forum Contributor
    Join Date
    11-10-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    260

    Re: macro uploaded, but how do I use it?

    Or, if there is a way around this, for example, just create a formula that will calculate automatically the 15 minutes average speed on column M based on the
    time in column C, how to do this?

    Screenshot - 17_10_2017 , 11_14_58.png

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,645

    Re: macro uploaded, but how do I use it?

    How would you calculate it manually?
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  8. #8
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: macro uploaded, but how do I use it?

    When you see a line which is highlighted in yellow, it means the code errors and stops going into next line.
    You have not posted the entire code- part of it missing and that is why the code is telling you that it could not find another code called frmSelectWorkbook.

  9. #9
    Forum Contributor
    Join Date
    11-10-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    260

    Re: macro uploaded, but how do I use it?

    Quote Originally Posted by AB33 View Post
    When you see a line which is highlighted in yellow, it means the code errors and stops going into next line.
    You have not posted the entire code- part of it missing and that is why the code is telling you that it could not find another code called frmSelectWorkbook.
    Then I'm confused. You uploaded a spreadhseet with the working macro. Then I wrote back saying that it works fine in that one you uploaded but it doesn't work if I try to apply
    to others... not sure what do you mean that the code is missing... if it is missing it wouldn't work for u as well, but you had it working, 4 posts above, ( Today, 05:31 AM ) with the newly added X column..

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,645

    Re: macro uploaded, but how do I use it?

    Closed as you have now posted to commercial services.

Closed Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Test uploaded workbook
    By Greg M in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-03-2016, 05:56 PM
  2. can uploaded files update?
    By Idler in forum Excel General
    Replies: 2
    Last Post: 12-06-2015, 07:50 PM
  3. Run a macro on an uploaded .csv file
    By dalfiuss in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-12-2015, 01:51 PM
  4. how to delete old uploaded files?
    By superchew in forum Excel General
    Replies: 1
    Last Post: 02-20-2015, 12:05 PM
  5. Images not files to be uploaded!!!
    By jakeembx in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-05-2014, 08:04 PM
  6. Macro that Deletes Orders previosly uploaded.
    By Kenekio in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-28-2010, 01:29 AM

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