Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
HowTo insert a blank row and move existing down
I have
Date C1 C2 C3 C4 10/3 256 212 456 18 10/2 12 98 77 45 I want Date C1 C2 C3 C4 blank row here - I'll put my new data on this row 10/3 256 212 456 18 10/2 12 98 77 45 p.s. I'm a VS 2003 C# guy not VB, for example using Excel; Excel.Worksheet sheet = (Excel.Worksheet)book.Worksheets["Passenger"]; sheet.get_Range("A13", "L99").Clear(); sheet.get_Range("L2", "L4").ClearContents(); Excel.Range rngNow = sheet.get_Range("J9", Missing.Value); |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
HowTo insert a blank row and move existing down
Hi Eggle,
Some one-liners for you, ' this inserts a blank row below the currently selected cell ActiveCell.EntireRow.Insert Shift:=xlDown ' this inserts a blank row below row 2 Rows("2:2").Insert Shift:=xlDown ' this moves a range in sheet 'Passenger' one row down Dim sht As Worksheet Dim rng As Range Dim dest As Range Set sht = ThisWorkbook.Worksheets("Passenger") Set rng = sht.Range("A2:E3") Set dest = rng.Offset(1, 0) rng.Cut sht.Paste Destination:=dest Ok, the last example is longer than one line. BTW something you get in Excel that you don't see in VS is the macro recorder. Look in Tools -- Macro. Makes it easy to work out this kind of stuff. Ed Ferrero Microsoft Excel MVP http://www.edferrero.com I have Date C1 C2 C3 C4 10/3 256 212 456 18 10/2 12 98 77 45 I want Date C1 C2 C3 C4 blank row here - I'll put my new data on this row 10/3 256 212 456 18 10/2 12 98 77 45 p.s. I'm a VS 2003 C# guy not VB, for example using Excel; Excel.Worksheet sheet = (Excel.Worksheet)book.Worksheets["Passenger"]; sheet.get_Range("A13", "L99").Clear(); sheet.get_Range("L2", "L4").ClearContents(); Excel.Range rngNow = sheet.get_Range("J9", Missing.Value); |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
insert another page into an existing one | Excel Worksheet Functions | |||
How to add a blank row after each existing row? | Excel Discussion (Misc queries) | |||
Macro code to test for blank row and insert blank row if false | Excel Programming | |||
Move Data Up One Row and Add On to Existing | Excel Worksheet Functions | |||
Move column to in-between existing columns | Excel Discussion (Misc queries) |