+ Reply to Thread
Results 1 to 2 of 2

VBA: Pasted Cells Not Formatted

  1. #1
    Forum Contributor
    Join Date
    12-22-2004
    Location
    Kokomo, Indiana
    Posts
    236

    Question VBA: Pasted Cells Not Formatted

    When I do a paste special, the cells being pasted don't format themselves like the cells where I did the copy from. See my structure below:

    'Select Sheet
    Sheets("Previous").Select

    'Select Cells
    Range("A2:B5").Select
    Selection.Copy

    'Select Sheet
    Sheets("Summary").Select
    Range("A2:B5").Select

    'Do Paste Special
    Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:=False, Transpose:=False

    Again, just a novice........but love learning this VBA


    Tony

  2. #2
    JE McGimpsey
    Guest

    Re: VBA: Pasted Cells Not Formatted

    What formatting isn't copied (font and cell formats copy for me)?

    Note that you don't need to select anything. Your macro could be
    replaced with one line:

    Sheets("Previous").Range("A2:B5").Copy Destination:= _
    Sheets("Summary").Range("A2:B5")

    Or, if you want to use Paste Special, two:

    Sheets("Previous").Range("A2:B5").Copy
    Sheets("Summary").Range("A2").PasteSpecial _
    Paste:=xlPasteAll, _
    Operation:=xlNone, _
    SkipBlanks:=False, _
    Transpose:=False


    In article <[email protected]>,
    ajocius <[email protected]> wrote:

    > When I do a paste special, the cells being pasted don't format
    > themselves like the cells where I did the copy from. See my structure
    > below:
    >
    > 'Select Sheet
    > Sheets("Previous").Select
    >
    > 'Select Cells
    > Range("A2:B5").Select
    > Selection.Copy
    >
    > 'Select Sheet
    > Sheets("Summary").Select
    > Range("A2:B5").Select
    >
    > 'Do Paste Special
    > Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
    > SkipBlanks:=False, Transpose:=False
    >
    > Again, just a novice........but love learning this VBA
    >
    >
    > Tony


+ 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