+ Reply to Thread
Results 1 to 2 of 2

VBA function not working as intended- Loop Problem?

  1. #1
    Registered User
    Join Date
    08-27-2018
    Location
    AZ, United States
    MS-Off Ver
    Office 365
    Posts
    1

    VBA function not working as intended- Loop Problem?

    Hello everyone, This is my first post here. I'm relatively new to using the deeper functions of excel. I have a little bit of experience with coding, but I typically only do so to make small programs that will make personal tasks more efficient.
    I have a workbook that I am using for automotive tuning. The end goal is to take user entered data consisting of 3 elements per row, compare that data to a 17*17 table, calculate an average correction factor for each point, and apply that correction factor to the original table, yielding a corrected map that can then be loaded onto the ECU of the car.

    I have done this using the following VBA code:



    Please Login or Register  to view this content.

    The issue I am having is that if the function encounters a set of data (or Column A and Column B combination) that lands it in the same cell as the previous cell, it does not add to my total correction table or visits table. IE if I had a set of data 50000 rows long where the index values of all data points to the same cell in my table, but provides a different correction factor for each sample, it only takes into account the first value and does nothing with the rest. If the function has to move to a new cell, and then back to a cell it has already visited, it works just fine however.

    Also, unrelated: in my Histogram Sub, I could not get the loop to work properly by using


    Please Login or Register  to view this content.
    Any pointers would be greatly appreciated. As far as my logical reasoning skills tell me, Sub should do exactly what I wanted it to do, so I'm completely stumped. Thanks in advance!
    Last edited by KrombopulosMichael; 08-27-2018 at 06:43 PM.

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: VBA function not working as intended- Loop Problem?

    Khalispera.

    We would like to help but

    1.

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Click on Edit to open your thread, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)


    2.

    Attach a sample workbook
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

+ 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. PowerPivot not working as intended?
    By fingerstyle in forum Excel General
    Replies: 11
    Last Post: 10-22-2017, 08:35 PM
  2. [SOLVED] worksheet_Change event not working as intended.
    By Kramxel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-07-2015, 04:00 AM
  3. Timed Macro not working as I intended
    By ufopilot in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-04-2015, 03:39 AM
  4. [SOLVED] Msgbox not working as intended
    By ks100 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-24-2013, 09:12 AM
  5. [SOLVED] VLOOKUP not working as intended
    By RAS 2112 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-12-2013, 08:58 AM
  6. For loop not running as intended, can't find the issue.
    By kenab1 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-17-2010, 03:11 PM
  7. [SOLVED] macro not working as intended
    By Michael A in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-06-2005, 10:06 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