+ Reply to Thread
Results 1 to 4 of 4

duplicates code works in one sheet but not another?

  1. #1
    Registered User
    Join Date
    11-18-2014
    Location
    australia
    MS-Off Ver
    2015
    Posts
    43

    duplicates code works in one sheet but not another?

    i have the following code (snippet), it takes a block of duplicate values (x) for which there may be 1 or thousands, and then averages the corresponding value (V) in column C, then prints that average value out to another range:

    Please Login or Register  to view this content.
    this is working for me just fine on one workbook, but the same exact code isn't working at all on another! the cells just stay blank, nothing happens at all

    EDIT:
    ok i've figured out that the only difference is that one book is importing a .csv, and the other is pasting data...so now to figure out how to force a .csv into excel data!
    Last edited by ferday; 07-05-2016 at 02:12 PM.

  2. #2
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: duplicates code works in one sheet but not another?

    It appears to me that you haven't included the whole code in your snippet. The code should start with something like "Sub...." or "Public Function ...." something along those lines and then end with "End Sub" or "End Function". The End part will match the beginning Sub or Public depending upon how the code starts.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  3. #3
    Registered User
    Join Date
    11-18-2014
    Location
    australia
    MS-Off Ver
    2015
    Posts
    43

    Re: duplicates code works in one sheet but not another?

    it's a portion from the middle, forgot to add it to the code to make it easy for anyone.

    i've figured out the problem - somewhat. i am importing a .csv file in the new book, the old book was pasting from an excel file. if i paste into the new book, the code is working fine...so the problem is that for some reason the .csv import is making the data unusable.

    i'm trying some things now to see if i can somehow modify the .csv data

  4. #4
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: duplicates code works in one sheet but not another?

    Check what should be numeric values in the CSV import. Perhaps they are text values that the code can't read.

+ 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. Replies: 2
    Last Post: 07-08-2015, 05:43 AM
  2. [SOLVED] Code works great...UNTIL i call it from another sheet- Why?
    By Ppessina in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-27-2013, 03:52 PM
  3. Code only works on a copy of the original sheet
    By timmtamm in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-19-2012, 01:07 PM
  4. Why a code that works for a sheet does not work for all?
    By marlonsaveri in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-31-2011, 12:29 PM
  5. Code not working on new sheet copied from a sheet that works
    By drewship in forum Excel Programming / VBA / Macros
    Replies: 23
    Last Post: 10-20-2010, 08:54 AM
  6. Same code works on one sheet and not the other
    By TraderGary in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-01-2010, 05:56 AM
  7. [SOLVED] Code Only works when sheet is in focus
    By Andibevan in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-26-2005, 12: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