+ Reply to Thread
Results 1 to 5 of 5

Easy macro problem to solve

  1. #1
    Registered User
    Join Date
    04-08-2013
    Location
    Wajdušna
    MS-Off Ver
    Office 365
    Posts
    79

    Easy macro problem to solve

    Hello,

    i have values in column A that i can use as reference point for the rows i want to delete. So whenever there is a value "listina" in cell A i want the code to delete this row and 4 rows that are bellow it.
    So if the value is in cell A39 i want the code to delete ROWS 39 to 43, and then go hunting for next cell where there is a cell with value "listina"
    This code dosent work it says that something is wrong on the step Next cell

    Please Login or Register  to view this content.
    Thank you for your help

  2. #2
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,234

    Re: Easy macro problem to solve

    1. don't use procedure or variable names that are identical to properties or methods, because this will get revenge one day.
    2. the "End If" was missing from the code.
    3. "LISTINA" is not the same as "Listina" or "LiStInA". If you want to delete all occurrences regardless of case, you'll have to work a little harder.

    Code after changes:
    Please Login or Register  to view this content.
    Artik

  3. #3
    Valued Forum Contributor
    Join Date
    06-29-2014
    Location
    Australia
    MS-Off Ver
    MSO 365
    Posts
    1,098

    Re: Easy macro problem to solve

    Hello Atop,

    Amending your existing code, assuming you have headings in row1, perhaps this:-

    Please Login or Register  to view this content.
    I hope that this helps.

    Cheerio,
    vcoolio.

  4. #4
    Registered User
    Join Date
    04-08-2013
    Location
    Wajdušna
    MS-Off Ver
    Office 365
    Posts
    79

    Re: Easy macro problem to solve

    Thank you both for your input, i was sloppy :D

    Thanks again

  5. #5
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,234

    Re: Easy macro problem to solve

    You can use the "Option Compare Text" directive at the beginning of the module, but you need to be aware of the consequences of its use. If there are other routines in the module that contain text comparison methods, they may return unexpected results, as case may be ignored. If this directive is used, there should only be procedures in the module that are supposed to ignore case.

    Artik

+ 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] VLookup Problem - Should be an Easy Solve!
    By mrsdeapsleap in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-01-2015, 01:55 PM
  2. VBA Userfrom problem - easy solve
    By ExcelFailure in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 07-04-2013, 04:36 AM
  3. How to convert a nonlinear set of values into percentages?
    By Mark Wood in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-10-2012, 04:22 AM
  4. Excel2007 Solver fails to solve apparently easy problem
    By Itsatwap in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-12-2011, 12:29 PM
  5. Easy problem for you to solve
    By MM17 in forum Excel General
    Replies: 1
    Last Post: 06-04-2009, 09:12 PM
  6. important and probably easy to solve
    By Marco Santos in forum Excel General
    Replies: 1
    Last Post: 11-27-2006, 06:08 AM
  7. (Easy-to-solve?) Printing Mytery
    By akexcel in forum Excel General
    Replies: 3
    Last Post: 11-01-2006, 04: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