Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Inserting a new table row without copying formats

I'm using the following code to insert a new row in a table.
Sheets(ToSheet).Range(ToTable).Rows(CursorTableRow Num) _
.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
This copies all formating from the above row to the new row.

How do I change/add code to avoid copying any row format info and just set
cols 1,2,6 & 7 to General format, col 3 to numeric, no decimals, and col 4&5
to date mm/dd/yy format, while everything else sets to a default cell format.

I appreciate your help, -John

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Inserting a new table row without copying formats

the default formating would be General. You could make the entire new row
General and then change columns 3 to numeric and column 4&5 to date like this

with Sheets(ToSheet).Range(ToTable)
.Rows(CursorTableRowNum).Insert Shift:=xlDown, _
CopyOrigin:=xlFormatFromLeftOrAbove
.Rows(CursorTableRowNum).numberformat = "General"
.Cells(CursorTableRowNum,"C").Numberformat = "0.00"
.Cells(CursorTableRowNum,"D").Numberformat = "mm/dd/yy"
.Cells(CursorTableRowNum,"E").Numberformat = "mm/dd/yy"
End with

"John" wrote:

I'm using the following code to insert a new row in a table.
Sheets(ToSheet).Range(ToTable).Rows(CursorTableRow Num) _
.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
This copies all formating from the above row to the new row.

How do I change/add code to avoid copying any row format info and just set
cols 1,2,6 & 7 to General format, col 3 to numeric, no decimals, and col 4&5
to date mm/dd/yy format, while everything else sets to a default cell format.

I appreciate your help, -John

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
copying conditional formats T. Valko Excel Discussion (Misc queries) 0 November 12th 09 08:01 PM
Copying formats - column widths, formats, outlining to worksheets DavidBr318 Excel Worksheet Functions 4 August 14th 09 05:03 AM
Copying Formats JoeSpareBedroom Excel Discussion (Misc queries) 9 February 7th 07 06:33 PM
Copying formats? Thief_ Excel Programming 3 April 15th 05 01:19 PM
Copying Cell Formats Mark Schreiber Excel Programming 2 December 20th 04 10:53 PM


All times are GMT +1. The time now is 11:43 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"