+ Reply to Thread
Results 1 to 15 of 15

Working macro for clean nedd to be changed

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

    Working macro for clean nedd to be changed

    HI I have below code which seems to help me. I had some problems when I copy from other place and run macros after. But this code help.
    I need to make the code so it can clean all sheet from row3. Its many columns and also can be many rows. Please have a look at the code, how it can be changed so it take all the sheet. And consider speed also.

    Thanks in advance

    Sincerely
    Abjac

    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Working macro for clean nedd to be changed

    set rng = .usedrange
    Last edited by nathansav; 09-03-2014 at 04:53 AM.
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  3. #3
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Working macro for clean nedd to be changed

    Add a row offset to Post# 2.

    Set rng = .UsedRange.offset(3)

  4. #4
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Working macro for clean nedd to be changed

    Yes, but only if there is something in rows 1 to 2

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

    Re: Working macro for clean nedd to be changed

    Hi Nathansav.

    Thanks for you answer.

    It don't work if put it just like that and if put in the end of the string also not.
    I know this one have to be changed but how if I want to able to select start row example.

    Please Login or Register  to view this content.
    Abjac

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Working macro for clean nedd to be changed

    Quote Originally Posted by nathansav View Post
    Yes, but only if there is something in rows 1 to 2
    I need to make the code so it can clean all sheet from row3.

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

    Re: Working macro for clean nedd to be changed

    I tried to replace this in the code.

    Please Login or Register  to view this content.
    with this

    Please Login or Register  to view this content.
    It give an error unqualified or invalid error,

    I have header in row 1 and other sheet also 2 , that's why I need this to be able to change

    Abjac

  8. #8
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Working macro for clean nedd to be changed

    Is it in the with block?

  9. #9
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Working macro for clean nedd to be changed

    Did you take it out of the With Statement? That's the only way I can duplicate the error.

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

    Re: Working macro for clean nedd to be changed

    HI Sorry just came home. I put below code in and now it don't give the error but its extreme slowly. I have attached a test sheet with data. Please try it there. Its like it continue after and stop long time after.

    Please look at the test sheet
    Abjac
    Here is my code.

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

  11. #11
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Working macro for clean nedd to be changed

    Turn your calculation off, application.calculation=xlCalculationManual

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

    Re: Working macro for clean nedd to be changed

    HI Tried that that make it even worse put the word FALSE in all cells. So it don't work. Please try the test sheet.

    Thanks

    Abjac

  13. #13
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Working macro for clean nedd to be changed

    maybe
    Please Login or Register  to view this content.

  14. #14
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Working macro for clean nedd to be changed

    Try the attached.
    Attached Files Attached Files
    Last edited by AB33; 09-03-2014 at 11:50 AM.

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

    Re: Working macro for clean nedd to be changed

    HI Sorry the code was working when I put it on manual. But still little slow but working thanks allot nathansav.

    Hi Nilem. Your code is really good and very fast. And Hi Ab33 yours are nearly the same and also very very fast.

    Thanks both of you. I will choose them, they speed it up very much.

    And thanks to you too Nathensav. Even a little slower it worked good.

    So thanks all for the great help.

    Sincerely

    Abjac

+ 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] Coding Convention Questions #2 (To clean up or not to clean up)
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 24
    Last Post: 03-31-2014, 08:18 PM
  2. Replies: 0
    Last Post: 08-13-2013, 06:10 PM
  3. [SOLVED] Need a hand to clean up working code (External Data fetch foreign exchange rates)
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-12-2013, 06:40 PM
  4. [SOLVED] Clean and Trim Not Working
    By HangMan in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-05-2013, 07:14 PM
  5. [SOLVED] VBA Code to optimize and clean data- clean out numerical/ or symbol
    By tracylsr in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-05-2012, 04:21 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