+ Reply to Thread
Results 1 to 9 of 9

macro copy, how to remove formatting?

  1. #1
    Registered User
    Join Date
    10-19-2009
    Location
    My Back Yard Garage
    MS-Off Ver
    Excel 2007
    Posts
    3

    Exclamation macro copy, how to remove formatting?

    new to the macro VB area, got my copy range of cells to work but I'd like to remove all the formating so its just standard text.

    As it stands, I have to paste the data into Note Pad to put it in standard line by line text.

    the problem is it is pasted into windows live mail with tabs at the end of each line and line breaks where there shouldnt be any.


    anyone help me figure this pickle out?

    thanks

  2. #2
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    Re: macro copy, how to remove formatting?

    Is this what you mean? This will paste it into the cell and whatever default formatting is in that cell will remain. You could also paste the cells and then have your macro re-format the cells to whatever format you desire. You can't just get rid of formatting. There has to be some sort of definition of font.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-19-2009
    Location
    My Back Yard Garage
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: macro copy, how to remove formatting?

    ohhh ok, i get a piece of the picture now.

    what about general formating? is there a way to just format a range of cells to general format?

    is there an argument i can combine with paste special to assign a general format rule for all cells copied into the clipboard?

    i was going to search on format in the forums but im a complete n00b to Visual Basic ... but without knowing what term to search for besides format and paste special, i imagine i'd be looking through tousands of topics? heh.


    man im such an00b

  4. #4
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: macro copy, how to remove formatting?

    You can change the format of a selection to general by:

    Please Login or Register  to view this content.
    Is your code running too slowly?
    Does your workbook or database have a bunch of duplicate pieces of data?
    Have a look at this article to learn the best ways to set up your projects.
    It will save both time and effort in the long run!


    Dave

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: macro copy, how to remove formatting?

    Please Login or Register  to view this content.
    This will not copy any formatting into A2.
    Entia non sunt multiplicanda sine necessitate

  6. #6
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    Re: macro copy, how to remove formatting?

    Please Login or Register  to view this content.
    I got the above by recording a macro while I selected the cell, right-clicked, chose "Format Cell" and under the "Font" tab, I selected the "Normal font" checkbox.

    This returns the cell font to whatever is the default font. So, if your default font is anything different than the above, you would need to modify the above code, or record a new macro.

    Taking this one step further, I came up with this, which fives it a "General" number format, adjusts the alignment and text control, returns the font to "normal" removes borders and changes the fill color to no fill:

    Please Login or Register  to view this content.
    Last edited by Whizbang; 10-19-2009 at 04:54 PM.

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: macro copy, how to remove formatting?

    Or just
    Please Login or Register  to view this content.
    Last edited by shg; 10-19-2009 at 05:06 PM. Reason: Corrected as noted in subsequent post

  8. #8
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    Re: macro copy, how to remove formatting?

    Quote Originally Posted by shg View Post
    Or just
    Please Login or Register  to view this content.
    Normal needs to be in quotation marks.

    Thanks for posting though. That is much simpler than what I recorded.

  9. #9
    Registered User
    Join Date
    10-19-2009
    Location
    My Back Yard Garage
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: macro copy, how to remove formatting?

    ok.
    thats helps a great deal, i appreciate it.

+ 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