View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default Insert rows without copying borders and shading

Sub insertrownoformat()
With ActiveCell
.Rows.Insert
.ClearFormats
End With
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"XP" wrote in message
...
I am coding a sheet in which I need to insert multiple rows and I have a
function that I can call that does this splendidly. The problem arises if
you
have a row with shading and borders ABOVE the row on which you are doing
an
insert, then the borders and shading from the row above is copied down
when
the insert is done.

I just want to do a row insert without the cell shading and borders being
copied down using VBA code. Can someone give me an easier way than having
to
reformat everything every time?

My current function I'm using is below (remove row wrapping):

Public Function RowsInsert(argStartCell As String, argRowsToInsert As
Long)
Range(Range(argStartCell).Address,
Range(Range(argStartCell).Offset(argRowsToInsert,
0).Address)).EntireRow.Insert Shift:=xlDown
End Function