+ Reply to Thread
Results 1 to 5 of 5

Counting errors from an exported file

  1. #1
    Registered User
    Join Date
    01-07-2011
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel 2007
    Posts
    4

    Counting errors from an exported file

    Hi,

    I have a problem that I have tried to solve during the last couple of days (im new into VBA programming)

    I have a list that is exported from a database. In this list i have different service request from customers. In the first column dates for the requests is entered and in the fifth column the requests is specified.

    I would like to write a VBA script that automatically finds the rows that corresponds to the service request (the rows between the corresponding dates) and search for some key words in the description (fifth column). If some keywords are found (for example "Värme", and "radiator") the request should be counted. If on the other hand some other keywords are found (for example "spis") then the request should be ignored.

    In the "template sheet" the result should be 2, since one of the requests contain the keyword "spis" and thus should not be counted.

    It would also be neat if the found requests could be presented in a chart by date (some kind of histogram) but that is not the top priority at this point.

    Thanks in advance!
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    01-07-2011
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Counting errors from an exported file

    Im still trying to find out how to solve this task.

    Just now im trying out how to pick a range. What is wrong with the following code:

    "A=1
    B=1
    C=4
    D=4
    Range (Cells(A,B),Cells(C,D)).select"? I would like to select the range A1:D4 in this case but I would like to be able to change the variables later.


    -----

    Activesheet.
    Range(... Does the trick!
    Last edited by Nalleman; 01-08-2011 at 02:30 PM.

  3. #3
    Registered User
    Join Date
    01-07-2011
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Counting errors from an exported file

    Please, could someone help me to write a "find"method that searches a range of cells for one or more words and return a "true" if some of the words is found in the range. I cant get a hang of this my self.

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Counting errors from an exported file

    Hi Nalleman
    This code is in the attached book
    Please Login or Register  to view this content.
    Have no idea if we're even approaching what you're looking for. All code goes in a general module. Ket me know how it works for you.

    John
    Attached Files Attached Files
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  5. #5
    Registered User
    Join Date
    01-07-2011
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Counting errors from an exported file

    Wow, thanks for the extensive code.

    I will try to implement it in the evening. I was just trying with the "range".find method but since my programming skills are not so good (yet... this help is very appreciated.

+ 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