Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy Range including Formats and Forumulas
We are trying to copy a Range to another worksheet in a C# Excel 2007 add-in
and want to get everything from the source range, including the cell formats and formulas. Our code is: Excel.ListObject inTable -- is passed to the function Excel.Range drange = inWorksheet.get_Range("A1", Type.Missing); Excel.Range tableRange = drange; Excel.ListColumn lcolumn = inTable.ListColumns[column]; lcolumn.Range.Copy(drange); Excel.Range trange = drange.get_Resize(lcolumn.Range.Count, 1); tableRange = inTable.Application.Union(tableRange, trange, Type.Missing, Type.Missing,Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, The result of the copy has only the values from the source range. Thanks. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy Range including Formats and Forumulas
We found the cause for this...a call to set the range style in another
function was messing up the copy. "ALV" wrote: We are trying to copy a Range to another worksheet in a C# Excel 2007 add-in and want to get everything from the source range, including the cell formats and formulas. Our code is: Excel.ListObject inTable -- is passed to the function Excel.Range drange = inWorksheet.get_Range("A1", Type.Missing); Excel.Range tableRange = drange; Excel.ListColumn lcolumn = inTable.ListColumns[column]; lcolumn.Range.Copy(drange); Excel.Range trange = drange.get_Resize(lcolumn.Range.Count, 1); tableRange = inTable.Application.Union(tableRange, trange, Type.Missing, Type.Missing,Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, The result of the copy has only the values from the source range. Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I copy a range in Excel without including hidden rows? | Excel Discussion (Misc queries) | |||
Copy Range / Including Adjacent Cells - into Existing Worksheet. | Excel Programming | |||
custom number formats - including text from other cells | Excel Programming | |||
copy range and formats to new workbook | Excel Programming | |||
Copy range and formats to new Workbook | Excel Programming |