Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 252
Default Insert an row without using select

Hi all,

I have an formated row for data, but I do not know the exact row row number
since the data amount is variable, so I make only one ready for copy and
insert after. I use the Record produced code like following:

Worksheets("printout").Rows(row + iItemStart & ":" & row + iItemStart).Select
Selection.Copy
Selection.Insert Shift:=xlDown
Application.CutCopyMode = False

but before I can use the code, I have to make the printout sheet the
activesheet, do I have other method?

Clara
--
thank you so much for your help
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 107
Default Insert an row without using select

Worksheets("Sheet2").Range("F19:H24").Copy
Worksheets("Sheet2").Range("L206").Insert Shift:=xlDown

The two lines above will copy and insert/paste without having to have Sheet2
the active sheet. I haven't tried, but I think there's no reason you
shouldn't have code inbetween the two lines, for example to find out just
where you're going to paste the data, as long as there's no pasting or
copying or cutting in them too.
Similar code can be used to copy/insert from/to different sheets, while a
third sheet could be the active sheet all along.
--
p45cal


"clara" wrote:

Hi all,

I have an formated row for data, but I do not know the exact row row number
since the data amount is variable, so I make only one ready for copy and
insert after. I use the Record produced code like following:

Worksheets("printout").Rows(row + iItemStart & ":" & row + iItemStart).Select
Selection.Copy
Selection.Insert Shift:=xlDown
Application.CutCopyMode = False

but before I can use the code, I have to make the printout sheet the
activesheet, do I have other method?

Clara
--
thank you so much for your help

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
I want to select a row and insert a copy later in the worksheet Dennis Milns Excel Worksheet Functions 3 June 26th 07 12:39 AM
Macro that will select and insert a new row and paste as value [email protected] Excel Worksheet Functions 3 December 5th 06 04:06 AM
I cannot select more than 1 picture to insert. Why? c3rc2 Excel Discussion (Misc queries) 4 June 30th 06 01:50 PM
Excel should allow "select all" and also "insert bookmark" as Wor. scurtin Excel Worksheet Functions 2 November 5th 04 02:46 AM
INSERT INTO..SELECT David Weilmuenster[_2_] Excel Programming 3 August 2nd 04 08:05 AM


All times are GMT +1. The time now is 11:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"