+ Reply to Thread
Results 1 to 13 of 13

for each problem with two conditions

  1. #1
    Forum Contributor
    Join Date
    10-26-2018
    Location
    Vienna, Austria
    MS-Off Ver
    2016 professional
    Posts
    148

    for each problem with two conditions

    Dear Users,

    can anyone please help me why my code doesnt work?

    (please also find the file attached)

    Please Login or Register  to view this content.

    thank you indeed for your kind help!

    br
    Peter
    Attached Files Attached Files

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,446

    Re: for each problem with two conditions

    Please explain what "doesn't work" means.
    • Does the code run?
    • Does it run but do nothing?
    • Does it produce error messages? If so, what do the messages say?
    • Does it produce unexpected/wrong results? If so, how do the results differ from what you expect?
    • Does it hang?

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: for each problem with two conditions

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    10-26-2018
    Location
    Vienna, Austria
    MS-Off Ver
    2016 professional
    Posts
    148

    Re: for each problem with two conditions

    ...thank you jindon... what a silly mistake

    one more question please.. my initial goal was to delete the row where the two conditions are met.. I wrote it like below but doesnt work..do you know why?


    Please Login or Register  to view this content.

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: for each problem with two conditions

    When you delete/add row(s)/column(s), better loop backwards like
    Please Login or Register  to view this content.
    For each deletes one row when consecutive rows/columns are to be deleted.
    Another would be Union method and delete all at the end, AutoFilter etc...

  6. #6
    Forum Contributor
    Join Date
    10-26-2018
    Location
    Vienna, Austria
    MS-Off Ver
    2016 professional
    Posts
    148

    Re: for each problem with two conditions

    very cool! thank you again jindon!

  7. #7
    Forum Contributor
    Join Date
    10-26-2018
    Location
    Vienna, Austria
    MS-Off Ver
    2016 professional
    Posts
    148

    Re: for each problem with two conditions

    Quote Originally Posted by Pepe Le Mokko View Post
    Please explain what "doesn't work" means.
    • Does the code run?
    • Does it run but do nothing?
    • Does it produce error messages? If so, what do the messages say?
    • Does it produce unexpected/wrong results? If so, how do the results differ from what you expect?
    • Does it hang?
    sorry about that Pepe Le Mokko!
    I will be more specific in the future

  8. #8
    Spammer
    Join Date
    02-04-2012
    Location
    Philippines
    MS-Off Ver
    Excel 2013
    Posts
    190

    Re: for each problem with two conditions

    Try this
    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    10-26-2018
    Location
    Vienna, Austria
    MS-Off Ver
    2016 professional
    Posts
    148

    Re: for each problem with two conditions

    Quote Originally Posted by Jean.P28 View Post
    Try this
    Please Login or Register  to view this content.
    makes sence too! thank you for your help and time!

  10. #10
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: for each problem with two conditions

    peterschein,

    You should be careful that your code is based on the named range, so if the range in the named range changes, yours and mine don't need to change, but the other one should.

  11. #11
    Forum Contributor
    Join Date
    10-26-2018
    Location
    Vienna, Austria
    MS-Off Ver
    2016 professional
    Posts
    148

    Re: for each problem with two conditions

    Quote Originally Posted by jindon View Post
    peterschein,

    You should be careful that your code is based on the named range, so if the range in the named range changes, yours and mine don't need to change, but the other one should.
    I am sorry but I am not sure what you mean. the range will change but since its a table it should not be a problem... what do you mean by "the other one should"?

  12. #12
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,446

    Re: for each problem with two conditions

    Please don't quote entire posts unnecessarily. They are just clutter and make threads hard to read.
    Use the "Quick reply" instead
    Thanks

  13. #13
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: for each problem with two conditions

    If your named range refers to, say C10:D100, my code doesn't need to be changed.

    That's what I'm saying.

+ 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. Problem around IF statements for multiple conditions
    By kris01 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-22-2019, 12:30 PM
  2. Vertical search? several conditions... problem
    By Seeboo in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 12-21-2016, 07:13 AM
  3. Two conditions problem
    By AVG123 in forum Excel General
    Replies: 1
    Last Post: 11-04-2016, 12:48 AM
  4. [SOLVED] problem with counting with multiple conditions
    By Titansfannatl in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 05-05-2015, 08:24 AM
  5. [SOLVED] having problem in sumproduct with three conditions
    By anand_erin in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-31-2012, 05:47 PM
  6. [SOLVED] strange problem with conditions in Sumproduct
    By katosh in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-21-2012, 10:43 AM
  7. Problem with 2 conditions in order to count
    By koncurn in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 03-30-2010, 12:30 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