Click here to Skip to main content
15,887,328 members
Home / Discussions / C#
   

C#

 
GeneralRe: exception trying to insert a range to an Excelsheet Pin
Harry6662-Jul-09 4:00
Harry6662-Jul-09 4:00 
GeneralRe: exception trying to insert a range to an Excelsheet Pin
MumbleB2-Jul-09 9:22
MumbleB2-Jul-09 9:22 
GeneralRe: exception trying to insert a range to an Excelsheet Pin
Harry6662-Jul-09 13:58
Harry6662-Jul-09 13:58 
GeneralRe: exception trying to insert a range to an Excelsheet Pin
MumbleB2-Jul-09 22:14
MumbleB2-Jul-09 22:14 
GeneralRe: exception trying to insert a range to an Excelsheet Pin
Harry6664-Jul-09 0:57
Harry6664-Jul-09 0:57 
Generalstill trying to insert a range to an Excelsheet Pin
Harry6664-Jul-09 4:14
Harry6664-Jul-09 4:14 
GeneralRe: still trying to insert a range to an Excelsheet Pin
MumbleB4-Jul-09 8:31
MumbleB4-Jul-09 8:31 
GeneralRe: still trying to insert a range to an Excelsheet Pin
Harry6665-Jul-09 4:38
Harry6665-Jul-09 4:38 
Thanks,

...but this was not of help Frown | :(

I already tried to record a makro, but with insert it just looked like...
Rows("10:10").Select
      Selection.Copy
      Selection.Insert Shift:=xlDown

Using Copy+paste it looked like...
Rows("10:10").Select
      Application.CutCopyMode = False
      Selection.Copy
      Rows("11:11").Select
      ActiveSheet.Paste

There is no PasteSpecial or such. (I use MS Office Excel 2007)
And the method Range.Copy() does have a parameter (Object Destination)
but I tried that as well and I get only to copy the contents.
Btw: the PasteSpecial()-method threw an exception while using xlPasteFormats,
telling me my ranges do not fit. Well, I know that they don't fit. I want the second row to like like the first, I want to make them fit.

My C# code looks like this
Excel.Range range = sheet.get_Range("A" + 10 , "Y" + 10 ).EntireRow;
range.Select();
range.Copy(Type.Missing);
range2 = sheetKL.get_Range("A" + 11 + i, "Y" + 11 + i).EntireRow;
range2.Activate();
range.PasteSpecial(Microsoft.Office.Interop.Excel.XlPasteType.xlPasteFormats,
Microsoft.Office.Interop.Excel.XlPasteSpecialOperation.xlPasteSpecialOperationNone,
false, false); // I still don't understand the last param, I tried all combinations of true/false
Frown | :( nbsp;  Frown | :( nbsp;  Frown | :( Mad | :mad:

Programming Excel is no fun. I think I'll try using a makro...
Harry

no plan,
no signature

GeneralUsing a makro Pin
Harry6665-Jul-09 6:04
Harry6665-Jul-09 6:04 
GeneralRe: still trying to insert a range to an Excelsheet Pin
MumbleB6-Jul-09 19:16
MumbleB6-Jul-09 19:16 
GeneralRe: still trying to insert a range to an Excelsheet Pin
Harry6669-Jul-09 3:32
Harry6669-Jul-09 3:32 
QuestionDowloading file, web aplication and C# Pin
hoshyarD2-Jul-09 0:34
hoshyarD2-Jul-09 0:34 
AnswerRe: Dowloading file, web aplication and C# Pin
Manas Bhardwaj2-Jul-09 0:36
professionalManas Bhardwaj2-Jul-09 0:36 
QuestionVista/Win7 Gadget's Flyout. Pin
Supriya Tonape2-Jul-09 0:30
Supriya Tonape2-Jul-09 0:30 
AnswerRe: Vista/Win7 Gadget's Flyout. Pin
musefan2-Jul-09 1:58
musefan2-Jul-09 1:58 
GeneralRe: Vista/Win7 Gadget's Flyout. Pin
Supriya Tonape2-Jul-09 6:38
Supriya Tonape2-Jul-09 6:38 
QuestionIndex was out of range. Must be non-negative and less than the size of the collection Pin
haleemasher2-Jul-09 0:22
haleemasher2-Jul-09 0:22 
AnswerRe: Index was out of range. Must be non-negative and less than the size of the collection Pin
N a v a n e e t h2-Jul-09 0:28
N a v a n e e t h2-Jul-09 0:28 
GeneralRe: Index was out of range. Must be non-negative and less than the size of the collection Pin
haleemasher2-Jul-09 0:37
haleemasher2-Jul-09 0:37 
GeneralRe: Index was out of range. Must be non-negative and less than the size of the collection Pin
Luc Pattyn2-Jul-09 0:54
sitebuilderLuc Pattyn2-Jul-09 0:54 
QuestionNonSerialized property. Pin
johnnycastle2-Jul-09 0:19
johnnycastle2-Jul-09 0:19 
AnswerRe: NonSerialized property. Pin
Keith Barrow2-Jul-09 1:56
professionalKeith Barrow2-Jul-09 1:56 
GeneralRe: NonSerialized property. Pin
dojohansen2-Jul-09 2:21
dojohansen2-Jul-09 2:21 
AnswerRe: NonSerialized property. Pin
dojohansen2-Jul-09 2:04
dojohansen2-Jul-09 2:04 
AnswerRe: NonSerialized property. Pin
johnnycastle2-Jul-09 2:43
johnnycastle2-Jul-09 2:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.