Copy format of row above my activecell

  • Thread starter Thread starter al007
  • Start date Start date
A

al007

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
 
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
 
Thxs,
Is there an alternative code which will filldown format only of my
selection
 
How can you modify you code to make it work for a selection containing
more than 1 row (instead of the active cell)
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top