+ Reply to Thread
Results 1 to 23 of 23

Macro is not finding or copying 0 at the start of the word.

  1. #1
    Registered User
    Join Date
    05-08-2019
    Location
    Czech Republic
    MS-Off Ver
    2016
    Posts
    86

    Macro is not finding or copying 0 at the start of the word.

    Hello,
    I have this VBA Code, its should find and paste some stuff.
    But when something starts with 0 its not copying that with 0.
    For example there is cell 00H57 it only copy H57.
    Any advise?




    Please Login or Register  to view this content.
    Last edited by MartinV10; 08-16-2019 at 03:52 AM.

  2. #2
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: Macro is not finding or copying 0 at the start of the word.

    Change this line
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    Or convert the target column format to text and then use paste special values
    Click the * to say thanks.

  3. #3
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831
    (removed as too late)

  4. #4
    Registered User
    Join Date
    05-08-2019
    Location
    Czech Republic
    MS-Off Ver
    2016
    Posts
    86

    Re: Macro is not finding or copying 0 at the start of the word.

    @PaulM100
    I changed the code and its writing object required.

    And converting format to text in final destination is not working.(there should be problem in copying somewhere?)

  5. #5
    Registered User
    Join Date
    05-08-2019
    Location
    Czech Republic
    MS-Off Ver
    2016
    Posts
    86

    Re: Macro is not finding or copying 0 at the start of the word.

    @Marc L Sorry?:D

  6. #6
    Registered User
    Join Date
    05-08-2019
    Location
    Czech Republic
    MS-Off Ver
    2016
    Posts
    86

    Re: Macro is not finding or copying 0 at the start of the word.

    Quote Originally Posted by PaulM100 View Post
    Change this line
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    Or convert the target column format to text and then use paste special values
    What Sheet1 doing in code?

  7. #7
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: Macro is not finding or copying 0 at the start of the word.

    Change "sheet1" to "match", as I forgot to do it.

  8. #8
    Registered User
    Join Date
    05-08-2019
    Location
    Czech Republic
    MS-Off Ver
    2016
    Posts
    86

    Re: Macro is not finding or copying 0 at the start of the word.

    @PaulM100 its still writing object required and debugger shows mistake in this:
    newWrkbk.Sheets("match").Range("B:F").pastespecial xlPasteValuesAndNumberFormats

  9. #9
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: Macro is not finding or copying 0 at the start of the word.

    Cause you are selecting a range of columns. DO you want it pasted in a specific cell like B2? Or in the next empty row? OR?

  10. #10
    Forum Contributor
    Join Date
    11-12-2012
    Location
    Jeddah, Saudi Arabia
    MS-Off Ver
    2010, 2013, 2016, Office 365
    Posts
    507

    Re: Macro is not finding or copying 0 at the start of the word.

    Change "newWrkbk" to "DestWbk"

  11. #11
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: Macro is not finding or copying 0 at the start of the word.

    Good point @Barieq

  12. #12
    Registered User
    Join Date
    05-08-2019
    Location
    Czech Republic
    MS-Off Ver
    2016
    Posts
    86

    Re: Macro is not finding or copying 0 at the start of the word.

    @PaulM100 @Barieq Would you believe me that its doesnt work still?:D Its copying already like it should but there are no 0 yet.
    I didn´t tell you one thing and that is that we are importing things from HTML.(protocol) if this change something?

  13. #13
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow


    As always it's difficult to imagine without any attachment !

  14. #14
    Registered User
    Join Date
    05-08-2019
    Location
    Czech Republic
    MS-Off Ver
    2016
    Posts
    86

    Re: Macro is not finding or copying 0 at the start of the word.

    @Marc L yeah obv. But not every file I can post to internet. I know its hard to find solution. But I post whole macro, where is problem. Sorry

  15. #15
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: Macro is not finding or copying 0 at the start of the word.

    Try adding this line:
    Please Login or Register  to view this content.

  16. #16
    Registered User
    Join Date
    05-08-2019
    Location
    Czech Republic
    MS-Off Ver
    2016
    Posts
    86

    Re: Macro is not finding or copying 0 at the start of the word.

    @PaulM1OO you mean add to basic version?
    Or your upgrade + this???

  17. #17
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: Macro is not finding or copying 0 at the start of the word.

    That line will convert the destination range to text and since you have a mix of numbers is letters is safe to do it, as it won't affect any numbers calculation. add this to that piece of code provided before

  18. #18
    Registered User
    Join Date
    05-08-2019
    Location
    Czech Republic
    MS-Off Ver
    2016
    Posts
    86

    Re: Macro is not finding or copying 0 at the start of the word.

    @PaulM100 Screw it man, still nothing.
    Code looks now like this. If I paste something wrong, I dont know. Iam quite dead:D Looking for this whole day. Thanks for your patiance.
    Please Login or Register  to view this content.

  19. #19
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: Macro is not finding or copying 0 at the start of the word.

    I am running out of ideas. Change the format to
    Please Login or Register  to view this content.
    It should change the number formatting

  20. #20
    Registered User
    Join Date
    05-08-2019
    Location
    Czech Republic
    MS-Off Ver
    2016
    Posts
    86

    Re: Macro is not finding or copying 0 at the start of the word.

    @PaulM100 not working :D F..k it, Thanks for your time. I will be trying that anyway. Thanks for your help.

  21. #21
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,830

    Re: Macro is not finding or copying 0 at the start of the word.

    Thread marked unsolved: the OP has further queries on this issue (duplicate thread closed - please continue here in THIS thread).
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  22. #22
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,830

    Re: Macro is not finding or copying 0 at the start of the word.

    MartinV10 - please post the follow on HTML question here. Thanks.

  23. #23
    Registered User
    Join Date
    05-08-2019
    Location
    Czech Republic
    MS-Off Ver
    2016
    Posts
    86

    Re: Macro is not finding or copying 0 at the start of the word.

    @PaulM100 Was doing that today, and your way with numberformat "0000" is working. Thank you very much. Final working code looks like this.

    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)

Similar Threads

  1. [SOLVED] Macro not finding all Word fields
    By Ochimus in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-28-2018, 01:49 PM
  2. [SOLVED] Macro for Finding column with title and copying it
    By Haidar123 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-01-2014, 09:38 AM
  3. Replies: 0
    Last Post: 08-07-2013, 09:50 AM
  4. Finding and copying rows that meet key word criteria
    By acrobaticgod in forum Excel General
    Replies: 12
    Last Post: 10-29-2011, 05:35 PM
  5. Finding and copying multiple criteria using macro
    By Kotler in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-28-2011, 03:41 PM
  6. Excel macro to Start Word and open latest saved file.rtf
    By BHudPE in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-09-2010, 10:45 PM
  7. [SOLVED] finding duplicate then copying macro..
    By Michael A in forum Excel General
    Replies: 7
    Last Post: 03-08-2005, 12:14 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