Consulting

Results 1 to 2 of 2

Thread: Can this macro be simplified?

  1. #1

    Can this macro be simplified?

    [VBA]Sub Format()
    '
    ' Macro2 Macro
    '
    ' Keyboard Shortcut: Ctrl+y
    '
    Range("U9:U19").Select
    Selection.Copy
    Range("W9:W19").Select
    Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
    SkipBlanks:=False, Transpose:=False
    Application.CutCopyMode = False
    Range("S9:S19").Select
    Selection.Copy
    Range("U9:U19").Select
    Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
    SkipBlanks:=False, Transpose:=False
    Application.CutCopyMode = False
    Columns("W:X").Select
    Selection.Columns.Ungroup
    Range("W9").Select
    End Sub[/VBA]
    Last edited by Bob Phillips; 03-10-2011 at 08:46 AM. Reason: Added VBA tags
    In life, small things bother you more than the big ones. You can sit on a mountain but not on a pin!

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Sub Format()
    Range("U9:U19").Copy
    Range("W9:W19").PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
    SkipBlanks:=False, Transpose:=False
    Range("S9:S19").Copy
    Range("U9:U19").PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
    SkipBlanks:=False, Transpose:=False
    Columns("W:X").Columns.Ungroup
    Range("W9").Select
    End Sub
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •