Closed Thread
Results 1 to 5 of 5

Copy format of row above my activecell

  1. #1
    al007
    Guest

    Copy format of row above my activecell

    I would like to copy format of row above my activecell with macro
    below:

    Sub Macro4()
    '
    ' Macro4 Macro
    ' Macro recorded 09-12-2005 by Albert Ng
    '

    ActiveCell.Offset(RowOffset:=-1, columnOffset:=0).EntireRow.Select
    Selection.Copy
    ActiveCell.EntireRow.Select
    Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
    SkipBlanks:=False, Transpose:=False
    End Sub

    But it's not working - can anybody help please.

    Thxs


  2. #2
    Rowan Drummond
    Guest

    Re: Copy format of row above my activecell

    You are currently copying the format of the row above the activecell
    over itself. Try:

    Sub Macro4()
    Dim rng As Range
    Set rng = ActiveCell
    Rows(rng.Row - 1).Copy
    Cells(rng.Row, 1).PasteSpecial Paste:=xlPasteFormats
    Application.CutCopyMode = False
    rng.Select
    End Sub

    Hope this helps
    Rowan


    al007 wrote:
    > I would like to copy format of row above my activecell with macro
    > below:
    >
    > Sub Macro4()
    > '
    > ' Macro4 Macro
    > ' Macro recorded 09-12-2005 by Albert Ng
    > '
    >
    > ActiveCell.Offset(RowOffset:=-1, columnOffset:=0).EntireRow.Select
    > Selection.Copy
    > ActiveCell.EntireRow.Select
    > Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
    > SkipBlanks:=False, Transpose:=False
    > End Sub
    >
    > But it's not working - can anybody help please.
    >
    > Thxs
    >


  3. #3
    al007
    Guest

    Re: Copy format of row above my activecell

    Thxs,
    Is there an alternative code which will filldown format only of my
    selection


  4. #4
    al007
    Guest

    Re: Copy format of row above my activecell

    How can you modify you code to make it work for a selection containing
    more than 1 row (instead of the active cell)


  5. #5
    Rookie 1st class
    Guest

    Re: Copy format of row above my activecell

    This adds 5 blank formatted lines to the botto. If this is similar to what
    you are after? use it with my blessing.
    Lou

    Public Sub AddBlankLines()
    ' Add Blank Lines Macro
    Worksheets("Recall").Select
    range("A1").Select
    ActiveSheet.Unprotect
    Rows("2:6").Select
    Selection.Copy
    Selection.End(xlDown).Select
    ActiveCell.Offset(1, 0).Select
    ActiveSheet.Paste
    ActiveCell.Offset(0, 1).Select
    Selection.Resize(5, 35).ClearContents
    ActiveSheet.Protect
    End Sub


    "al007" wrote:

    > How can you modify you code to make it work for a selection containing
    > more than 1 row (instead of the active cell)
    >
    >


Closed 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