ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Insert Row without Selecting (https://www.excelbanter.com/excel-programming/308648-insert-row-without-selecting.html)

David Jenkins[_2_]

Insert Row without Selecting
 
I'd like to be able to insert a new row without having to
select a row first. This is the syntax I'm using (from a
recorded macro):

TargCell.EntireRow.Select
Selection.Insert Shift:=xlDown

I don't want to have to do a select because the sheet I'm
manipulating is (windows(sheetname).visible = false), and
currently I have to "unhide" it in order to insert the
row, or I get an error trying to do the select when it's
hidden.

Any help would be appreciated.

David Jenkins

Jake Marx[_3_]

Insert Row without Selecting
 
Hi David,

David Jenkins wrote:
I'd like to be able to insert a new row without having to
select a row first. This is the syntax I'm using (from a
recorded macro):

TargCell.EntireRow.Select
Selection.Insert Shift:=xlDown

I don't want to have to do a select because the sheet I'm
manipulating is (windows(sheetname).visible = false), and
currently I have to "unhide" it in order to insert the
row, or I get an error trying to do the select when it's
hidden.


TargCell.EntireRow.Insert Shift:=xlDown

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]

David Jenkins[_2_]

Insert Row without Selecting
 
Beautiful! Thanks, Jake!


-----Original Message-----
Hi David,

David Jenkins wrote:
I'd like to be able to insert a new row without having

to
select a row first. This is the syntax I'm using (from

a
recorded macro):

TargCell.EntireRow.Select
Selection.Insert Shift:=xlDown

I don't want to have to do a select because the sheet

I'm
manipulating is (windows(sheetname).visible = false),

and
currently I have to "unhide" it in order to insert the
row, or I get an error trying to do the select when it's
hidden.


TargCell.EntireRow.Insert Shift:=xlDown

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address

unmonitored]
.


mangesh_yadav[_69_]

Insert Row without Selecting
 
Worksheets(SheetName).Rows("10:10").EntireRow.Inse rt

- Manges

--
Message posted from http://www.ExcelForum.com


mangesh_yadav[_70_]

Insert Row without Selecting
 
Worksheets(SheetName).Rows("10:10").EntireRow.Inse rt

if you try to select a hidden sheet you get an error. so do not use
select. use the insert directly. The above line inserts row 10

- Manges

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 05:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com