Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default VB.NET insert row in Excel XP

Hi,

I am trying to insert a whole row and shift the data down
in a spreadsheet. I am using VB.NET and have all the
references to office and Excel in my project.

I keep getting error when I try this.

oSheet.Range("A" & 7,"A" & 8).insert()
or
osheet.Range("A" & 7,"A" & 8).select()
with oXl.Selection
osheet.rows.entireselection.insert()

or a bunch of other combinations as well

The error I get is a fatal one that says cannot move
cells down if they are not empty and I have tried empty
spreadsheets as well.

Thanks,

PS please forgive an syntax errors I made.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 132
Default VB.NET insert row in Excel XP

Im not sure if this is what you are looking for but try:

Sub try()
ActiveCell.EntireRow.Insert

End Sub
-----Original Message-----
Hi,

I am trying to insert a whole row and shift the data down
in a spreadsheet. I am using VB.NET and have all the
references to office and Excel in my project.

I keep getting error when I try this.

oSheet.Range("A" & 7,"A" & 8).insert()
or
osheet.Range("A" & 7,"A" & 8).select()
with oXl.Selection
osheet.rows.entireselection.insert()

or a bunch of other combinations as well

The error I get is a fatal one that says cannot move
cells down if they are not empty and I have tried empty
spreadsheets as well.

Thanks,

PS please forgive an syntax errors I made.

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default VB.NET insert row in Excel XP

ActiveCell.EntireRow.Insert

ActiveCell is not valid in my vb.bet applicaion is there
suppose to be a way to initialize it. I usually select a
cell using a workSeet variable called osheet. So I can
say osheet.cells(3,4).whatever I am doing. But if I use
the osheet.cells or osheet.range and the select the app
blows up.

Thanks,
Ben
-----Original Message-----
Im not sure if this is what you are looking for but try:

Sub try()
ActiveCell.EntireRow.Insert

End Sub
-----Original Message-----
Hi,

I am trying to insert a whole row and shift the data

down
in a spreadsheet. I am using VB.NET and have all the
references to office and Excel in my project.

I keep getting error when I try this.

oSheet.Range("A" & 7,"A" & 8).insert()
or
osheet.Range("A" & 7,"A" & 8).select()
with oXl.Selection
osheet.rows.entireselection.insert()

or a bunch of other combinations as well

The error I get is a fatal one that says cannot move
cells down if they are not empty and I have tried empty
spreadsheets as well.

Thanks,

PS please forgive an syntax errors I made.

.

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default VB.NET insert row in Excel XP

oSheet.Range("A7").EntireRow.insert

Will insert a single row.

--
Regards,
Tom Ogilvy


Ben wrote in message
...
Hi,

I am trying to insert a whole row and shift the data down
in a spreadsheet. I am using VB.NET and have all the
references to office and Excel in my project.

I keep getting error when I try this.

oSheet.Range("A" & 7,"A" & 8).insert()
or
osheet.Range("A" & 7,"A" & 8).select()
with oXl.Selection
osheet.rows.entireselection.insert()

or a bunch of other combinations as well

The error I get is a fatal one that says cannot move
cells down if they are not empty and I have tried empty
spreadsheets as well.

Thanks,

PS please forgive an syntax errors I made.



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
Cannot insert worksheet in exel - not available in insert menu pedro39 Excel Worksheet Functions 1 July 24th 08 12:09 PM
insert row / insert column command buttons fairgreen Excel Worksheet Functions 1 October 29th 07 02:41 PM
How can I insert a date with an icon (calendar) insert Alfredo Mederico[_2_] Excel Discussion (Misc queries) 4 September 21st 07 01:20 AM
unable to insert columns in excel, insert- columns (disabled) iam_leearner Excel Discussion (Misc queries) 1 August 13th 06 02:26 PM
Can I auto insert a worksheet when I insert a value in a cell. iainc Excel Worksheet Functions 0 April 27th 06 08:37 AM


All times are GMT +1. The time now is 01:05 AM.

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"