+ Reply to Thread
Results 1 to 6 of 6

Help : Code to assign speeds in speed bins

  1. #1
    Registered User
    Join Date
    11-15-2011
    Location
    Scotland
    MS-Off Ver
    Excel 2007
    Posts
    19

    Help : Code to assign speeds in speed bins

    Hi everyone...

    Hope you's are all well.

    Can anyone assist with this piece of code that I have tried to "Adjust/Manipulate" to work with speed bins ? ( My attempt Attached).... cant seem to see where i have gone wrong ( i have limited knowledge of codeing).

    Basically i have an excel sheet which contains a column with the Exact Speed and i need it to categorise the values into set Speed Bins ( There are over 10k records).

    Hope someone can assist, any further questions then please feel free to ask.

    Thanks

    Gee
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Help : Code to assign speeds in speed bins

    you are referencing a variable value, which isnt defined, try

    if Cells(intRow, strCol).Value < 16


    etc.
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  3. #3
    Valued Forum Contributor Miroslav R.'s Avatar
    Join Date
    05-16-2013
    Location
    NMnV, Slovakia
    MS-Off Ver
    Excel 2007
    Posts
    479

    Re: Help : Code to assign speeds in speed bins

    Hi there,
    Your code miss '=' sign:
    Please Login or Register  to view this content.
    should be:
    Please Login or Register  to view this content.
    like in first category.

    Also I miss a range everywhere the 'value' stands alone:
    Please Login or Register  to view this content.
    should be written:
    Please Login or Register  to view this content.
    (When You click in macro, hit F8 to debug line by line and You will se where all the errors are. Or go to menu in VBA-> Debug->Compile VBAProject)
    Regards
    Miroslav R.

    (If You like my solutions, feel free to add reputation.)

  4. #4
    Registered User
    Join Date
    11-15-2011
    Location
    Scotland
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Help : Code to assign speeds in speed bins

    Hi Miroslav,

    Thanks for your detailed responce.

    I have made the changes you have requested ( updated sheet attached) and tried the debug but it is still stopping at the 1st line ...

    Can you provide further assistance / help ?

    Many thanks

    Gee
    Attached Files Attached Files

  5. #5
    Valued Forum Contributor Miroslav R.'s Avatar
    Join Date
    05-16-2013
    Location
    NMnV, Slovakia
    MS-Off Ver
    Excel 2007
    Posts
    479

    Re: Help : Code to assign speeds in speed bins

    Hi there,
    instad of posting .txt files, can You upload excel workbook? So I can test it on real data source...

  6. #6
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Help : Code to assign speeds in speed bins

    inputbox returns string type and you're passing into long. Try Clng(inputbox.....)

+ 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. [SOLVED] Formula for differences in speeds
    By auntbev in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-12-2013, 07:38 PM
  2. Speed up my CODE
    By joh46k in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 08-07-2013, 02:03 AM
  3. calculating speeds in mph
    By Jock W in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 07-02-2006, 07:30 AM
  4. [SOLVED] Why doesMacro speeds up when I hit ESC?
    By ExcelMonkey in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-26-2005, 01:24 PM
  5. [SOLVED] Speed up Code?
    By Sige in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-27-2005, 02:05 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