+ Reply to Thread
Results 1 to 17 of 17

Macro to extract numbers over 6 digets in column

  1. #1
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Macro to extract numbers over 6 digets in column

    Help Needed.
    Hi I would like to have a macro to extract numbers over 6 digits in specific column (A it could be) and keep the complete rows for the ones which is over 6 digits. I am not so good to forms and this have to be used with other macroes. Thats why i need a macro.
    It would be nice if it have input boxes to select the column and the amount of digits.

    Sincerely

    Abjac

  2. #2
    Valued Forum Contributor
    Join Date
    02-09-2012
    Location
    Mauritius
    MS-Off Ver
    Excel 2007
    Posts
    1,055

    Re: Macro to extract numbers over 6 digets in column

    Hi Abjac.

    Could you give some example? Sorry didn't get what you were trying to say.
    Click *, if my suggestion helps you. Have a good day!!

  3. #3
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Macro to extract numbers over 6 digets in column

    Hi Jraj1106. Yes of course on below sample sheet i want only the numbers in column A over 6 digets to be there after run the macro. But would be good if i can change the number with an input box and also range.
    It have to delete the complete row for the one which is 6 digits or under.

    So 1 inputbox with "set range"
    1 inputbox with "Set number of digits you want to filter away in selected column, example 6 will filter away all numbers from 0 to 6 digits, with the complete belonging row"

    And then a macro which will do the filtering on upper settings-

    But most important is a macro which work also in a column with many rows.If not input boxes its ok, just i can change it in the code


    Please have a look thanks

    Sincerely

    Abjac
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Macro to extract numbers over 6 digets in column

    This code delete all cells in column A, which dont have the letter C. Maybe that one can be change to delete all which have digit between 0 and 6. ??
    The code is like this

    Please Login or Register  to view this content.
    I dont know if this one can be moderated to do the think i want, but have a look at it all.

    Thanks

    Abjac

  5. #5
    Valued Forum Contributor
    Join Date
    02-12-2011
    Location
    The Netherlands
    MS-Off Ver
    365
    Posts
    818

    Re: Macro to extract numbers over 6 digets in column

    Try it once abjac.
    Please Login or Register  to view this content.
    Kind regards, Harry.

  6. #6
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Macro to extract numbers over 6 digets in column

    HI HSV Thanks for the code. I tried it but it dont work. I suppose i shall just write A in the first box to set column. And in the second i type 6, to delete all from 6 and under right?
    If you can try in the sample sheet i send here.

    Sincerely Abjac

  7. #7
    Valued Forum Contributor
    Join Date
    02-12-2011
    Location
    The Netherlands
    MS-Off Ver
    365
    Posts
    818

    Re: Macro to extract numbers over 6 digets in column

    See the attachment.
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Macro to extract numbers over 6 digets in column

    HI HSV That was a problem work on my work laptop here and they use excel 2003 which cant open your file. Could you send it in excel 2003 or show the newer code here so i can try?

    Abjac

  9. #9
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Macro to extract numbers over 6 digets in column

    Ok I downloaded a conversation package so i can open it. Sorry its working for sure.
    Just some few things. Is it possible to change it so it display the result in the column i choose. (delete ther other in that column) And that it will delete the complete row for those it delete?

    Sincerely Abjac

  10. #10
    Valued Forum Contributor
    Join Date
    02-12-2011
    Location
    The Netherlands
    MS-Off Ver
    365
    Posts
    818

    Re: Macro to extract numbers over 6 digets in column

    Is deleting the entire row (which smaller than 6 digits) not enough ?

  11. #11
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Macro to extract numbers over 6 digets in column

    HI HSV Yes thats ok, but when i try the code i dont delete the intire row. In this code i have moderated it a little.
    I put the numbers in column A and the result will come in column B. So it display the result in column B, instead of in column A. And it also dont delete the complete row , where the digit are under 6.
    This how it look after run the code .I type column A in first inputbox and type 6 in the other. And the result come in column B and dont delete the rows.

    Please Login or Register  to view this content.
    THis is the code i used, changed a little so the result come in column B.

    Please Login or Register  to view this content.
    If it can delete the numbers in the column A (or the one i choose) , which are 6 and under. And then also delete the complete row for those.

    It will really be perfect.

    Please have a look

    Thanks in advance

    Sincerely

    Abjac
    Last edited by abjac; 01-23-2013 at 02:21 PM.

  12. #12
    Valued Forum Contributor
    Join Date
    02-12-2011
    Location
    The Netherlands
    MS-Off Ver
    365
    Posts
    818

    Re: Macro to extract numbers over 6 digets in column

    Hello abjac,

    Try it once.
    Please Login or Register  to view this content.

  13. #13
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Macro to extract numbers over 6 digets in column

    Hi HSV Its nearly there now. I tried your code and its close. I have problem with the Range("B1").it put the result there, if i change to A1 its ok. But not for all combinations. I made this little workaround. It is a workaround, but its working ok.
    I put x1 in the range and after i run a macro to delete row x.

    This code is working fine in all combinations. Only one little problem. If i by mistake put a column where there is not numbers but text.
    It delete all columns which is not so good.

    If that can be corrected its perfect.

    The code look like this.

    Please Login or Register  to view this content.
    Macro 1 delete column x

    Please see if its possible to solve the problem with the wrong input, so it dont delete all columns, if i type a column with only text.

    Thanks in advance

    Sincerely
    Abjac

  14. #14
    Valued Forum Contributor
    Join Date
    02-12-2011
    Location
    The Netherlands
    MS-Off Ver
    365
    Posts
    818

    Re: Macro to extract numbers over 6 digets in column

    Do you mean it this way?
    Please Login or Register  to view this content.
    Else: upload a example file.

  15. #15
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Macro to extract numbers over 6 digets in column

    Hi HSV still giving an error. Below is a sample test.
    My code is working just changed B1 to X1. It move the result there and after delete with macro 1. But all the other work perfect.
    Only error is quite serious. If you in my below sheet type B in inputbox 1 by mistake. and put 6 in the next inputbox. It will come with and error, because there is text in column B. And the worst it will delete all. And that must not happen. Can be very bad if you work with many rows.

    Please have a look

    This is my code . And also try look at the sample sheet with the numbers there.

    Thanks

    SIncerely

    Abjac

    Please Login or Register  to view this content.
    Attached Files Attached Files

  16. #16
    Valued Forum Contributor
    Join Date
    02-12-2011
    Location
    The Netherlands
    MS-Off Ver
    365
    Posts
    818

    Re: Macro to extract numbers over 6 digets in column

    New test.
    Please Login or Register  to view this content.

  17. #17
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Macro to extract numbers over 6 digets in column

    HIi HSV. Now it is there and really working perfect.
    If i type the column with text by mistake nothing happen.
    And what ever column i choose its working perfect and i have tried it in bigger file and added a little to the code. But thanks for your patiance. Its really great. Thanks allot

    Sincerely Abjac

    The finish codé working is like below. I activate it in Sheet 3


    Please Login or Register  to view this content.

+ 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