+ Reply to Thread
Results 1 to 6 of 6

Macro change the format need to keep original

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

    Macro change the format need to keep original

    Hi In below macro i have problem with that it change the format. Its a part of other codes and i need it to be copied to sheet "Robot" in the original format from column C8:C29 in Sheet Spain. Code below is from Marc and its brilliant, but i cant figure out to change this.

    I have attached a test sheet, so you can see how its formatted now. in column C sheet Spain. Specially i really need all the leading zeroes to get copied. But i need it to keep the formatting.

    Please have a look
    Sincerely
    Abjac

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

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Macro change the format need to keep original

    Hi, abjac,

    maybe try
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  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 change the format need to keep original

    Hi Holger nice to see you here again and thanks for the answer. It gave the same result. It copy and all are in text format, but it dont work because some in the column have a custom format. So the result was the same without the zeroes in front.
    Try play with the test sheet, here you can see the format it its possible to format B8 to B29 to text so it keeps the zeroes infront, that was maybe a solution before make the copy to sheet Robot.

    Have a look if time.

    Sincerely
    Abjac

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Macro change the format need to keep original

    Hi,abjac,

    I misssed to add the .Text. Please try
    Please Login or Register  to view this content.
    Ciao,
    Holger

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

    Re: Macro change the format need to keep original

    Hi Holger. It was fine it put the zeroes as input there now. But the result are not the same. The first macro made the correct result, but did not have the leading zeroes. This macro have the leading zeroes but it give the wrong result. Tried to figure out why, but cant see why its like that

    You can see the result with the first code, its correct but try ur second and it add the zeroes but the result is not the same
    Have a look in the new attached sheet. It jump over some of the input.

    Have a look please

    Sincerely

    Abjac
    Attached Files Attached Files
    Last edited by abjac; 07-27-2014 at 07:31 AM.

  6. #6
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Macro change the format need to keep original

    Hi, abjac,

    my bad, I mixed the place where to put the variable lngHelp.

    Loop should run from 1 to 18 (not 19 like in the last post) and please replace
    Please Login or Register  to view this content.
    with
    Please Login or Register  to view this content.
    and see if that fixes the issue.

    Ciao,
    Holger

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

    Re: Macro change the format need to keep original

    Hi Holger that did the trick. The code just run perfect. Wow.. Thanks allot again for your brilliant help, its really appriciated much
    Have a nice day.

    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] Format painting formula to adjacent cell, and want the result to be in the original format
    By SF1eagles in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-03-2014, 10:49 AM
  2. Replies: 3
    Last Post: 09-14-2013, 02:22 AM
  3. [SOLVED] Macro to copy cell width to new sheets (ie copy original sheet format)
    By teenyjem in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-20-2013, 07:28 AM
  4. MACRO to change the format of all worksheets into a specified format
    By usama.anwar in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-01-2013, 04:57 PM
  5. making copied cells change with change in original cell
    By Jennifer Mcdermeit in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-20-2006, 11:58 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