View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
PY & Associates[_4_] PY & Associates[_4_] is offline
external usenet poster
 
Posts: 46
Default Insert new row above and copy Formatting

You did not miss pastespecial.
You missed to select where to paste please

"Steved" wrote:

Helo from Steved

Thanyou for pointing out Selection.PasteSpecial

So I am now partly their.

Thankyou



"PY & Associates" wrote:

Range("A6:Q6").Select
Selection.EntireRow.Insert
Range("A7:Q7").Select
Selection.Copy
Range("A6:Q6").Select

Selection.PasteSpecial

"Steved" wrote:

Hello from Steved

In My workbook I've inserted 250 rows

Question Using below macro I put the cursor A6 to Q6 then use insert to
insert a row above, I have now gone to Row A7 to Q7 using the paint brush put
the cursor in A6 which using the formatting of row 7 has noe formated the new
row A6.

Is it possible in VBA to do the above.
The reason is instead of inserting 250 rows i only need to insert 1 row.

Ok if i type in D6 "90201" and then push the enter key it also will activate
VBA to insert the new row.

Sub insertrow()
Range("A6:Q6").Select
Selection.EntireRow.Insert
Range("A7:Q7").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Range("A6:Q6").Select
End Sub

Thankyou.