+ Reply to Thread
Results 1 to 10 of 10

Check amount is in range if not copy to New Worksheet

  1. #1
    Forum Contributor
    Join Date
    12-18-2019
    Location
    chennai
    MS-Off Ver
    excel 2010
    Posts
    141

    Post Check amount is in range if not copy to New Worksheet

    Hi

    Please help me for VBA Code

    I have data in my active worksheet from Column A

    Column A is having numbers,

    Column B is description

    Column D is Amount

    need to check Column A and Column D be with the below Criteria
    If amount column, (as per Sample its Column D) not matching with the below criteria, than those lines to be copy pasted in new worksheet, with Criteria comments

    Column D is not fixed one, so that need to be selected through message box


    Criteria

    From To Amount Column (Currently its Column D)
    100 200 Should be Positive
    200 300 Should be Positive
    300 400 Should be Negative
    400 500 Should be Negative
    405 Should Be Nil
    408 Should Be Nil
    500 600 Should be Positive
    600 700 Should be Positive
    800 900 Should be Negative
    900 1000 Should be Negative

    Sample file attached
    Attached Files Attached Files

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Check amount is in range if not copy to New Worksheet

    What about values like 300 & 500 that exist in both the To and From categories but have different sign requirements?

    What about 701 - 799
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Contributor
    Join Date
    12-18-2019
    Location
    chennai
    MS-Off Ver
    excel 2010
    Posts
    141

    Re: Check amount is in range if not copy to New Worksheet

    Hi Richard Buttrey

    Thanks
    You are correct it should be as below

    300 to 399 Should be Negative
    400 to 499 Should be Negative

    On 400 to 500, specifically 405 Should Be Nil and
    408 Should Be Nil

    500 to 599 Should be Positive



    701 - 799 no action required.

  4. #4
    Valued Forum Contributor
    Join Date
    11-04-2018
    Location
    Denpasar
    MS-Off Ver
    Excel 2010
    Posts
    777

    Re: Check amount is in range if not copy to New Worksheet

    Maybe something like this ?
    Please Login or Register  to view this content.
    The code above put the result on the same sheet (Sheet1), column P.
    Change the sh1, sh2, rg and cl according to your need.
    Last edited by karmapala; 08-05-2020 at 03:17 AM.

  5. #5
    Forum Contributor
    Join Date
    12-18-2019
    Location
    chennai
    MS-Off Ver
    excel 2010
    Posts
    141

    Re: Check amount is in range if not copy to New Worksheet

    Hi Karmapala

    Thank you so much for your help. The Code is working as expected.
    Can you please include the "Comments" column also on the Results
    Attached Images Attached Images

  6. #6
    Forum Contributor
    Join Date
    12-18-2019
    Location
    chennai
    MS-Off Ver
    excel 2010
    Posts
    141

    Re: Check amount is in range if not copy to New Worksheet

    Hi Karmapala

    Adding additional lines as below results are showing with comments

    Please Login or Register  to view this content.
    Thank you so much for your helo

  7. #7
    Forum Contributor
    Join Date
    12-18-2019
    Location
    chennai
    MS-Off Ver
    excel 2010
    Posts
    141

    Re: Check amount is in range if not copy to New Worksheet

    Hi Karmapala

    Adding additional lines as below, results are showing with comments

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

  8. #8
    Valued Forum Contributor
    Join Date
    11-04-2018
    Location
    Denpasar
    MS-Off Ver
    Excel 2010
    Posts
    777

    Re: Check amount is in range if not copy to New Worksheet

    Oops... sorry I'm wrong to get what you mean.

    Like this ?
    Please Login or Register  to view this content.
    So, the "amount" value is still the same - it just add the comment.

  9. #9
    Forum Contributor
    Join Date
    12-18-2019
    Location
    chennai
    MS-Off Ver
    excel 2010
    Posts
    141

    Re: Check amount is in range if not copy to New Worksheet

    Yes Exactly. Amount value is still the Same It Just add the comment

  10. #10
    Valued Forum Contributor
    Join Date
    11-04-2018
    Location
    Denpasar
    MS-Off Ver
    Excel 2010
    Posts
    777

    Re: Check amount is in range if not copy to New Worksheet

    Quote Originally Posted by ayyappan80 View Post
    Hi Karmapala

    Adding additional lines as below, results are showing with comments

    Please Login or Register  to view this content.
    Thank you so much for your help
    Nice.... now you can do it by yourself .

+ 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] VBA - check range in worksheet contains values
    By Sophie02 in forum Excel Programming / VBA / Macros
    Replies: 22
    Last Post: 08-03-2015, 07:25 AM
  2. VBA Copy row into new worksheet based on Control Form Check Box
    By carlosriver24 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-06-2013, 10:42 PM
  3. check each cell for certain condition, copy the content in a new worksheet
    By cyin in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-21-2012, 09:49 PM
  4. Check if Value Exists in Range For Worksheet Filtering
    By DGA2008 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-03-2009, 12:03 PM
  5. Macro to check range, if false check another range until true, then copy
    By jayers in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-12-2009, 04:19 PM
  6. How to check value of column from other Worksheet & copy corresponding value
    By NintyYears in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-18-2008, 06:02 AM

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