Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default copy and paste from row below

am trying to get the following code to copy data from the row below the row
it inserts a new line, instead of the fixed (copy from 17 and paste into 16
as it is at the min

Thanks



For Each sh In Worksheets(Array("Jan", "Feb", "March", "april", "may",
"June", "July", "Aug", "Sep", "Oct", "Nov", "Dec", "Overview"))
sh.Rows(x).Insert
Range("B17:e17").Select
Selection.Copy
Range("B16").Select
ActiveSheet.Paste
Next sh


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 139
Default copy and paste from row below

Rich:

try,

For Each sh In Worksheets(Array("Jan", "Feb", "March", _
"april", "may", "June", "July", "Aug", "Sep", "Oct", "Nov", "Dec",
"Overview"))
With sh
'sh.Rows(x).Insert
.Range("B17:e17").Copy .Range("B16")
End With
Next sh

--
天行健,君*以自強不息
地勢坤,君*以厚德載物

http://www.vba.com.tw/plog/


"Rich" wrote:

am trying to get the following code to copy data from the row below the row
it inserts a new line, instead of the fixed (copy from 17 and paste into 16
as it is at the min

Thanks



For Each sh In Worksheets(Array("Jan", "Feb", "March", "april", "may",
"June", "July", "Aug", "Sep", "Oct", "Nov", "Dec", "Overview"))
sh.Rows(x).Insert
Range("B17:e17").Select
Selection.Copy
Range("B16").Select
ActiveSheet.Paste
Next sh


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default copy and paste from row below

Hi Rich,

Try something like:

'=============
Public Sub Tester002()
Dim SH As Worksheet
Dim rng As Range
Const i As Long = 16

For Each SH In Worksheets(Array("Jan", "Feb", "March", "april", _
"may", "June", "July", "Aug", _
"Sep", "Oct", "Nov", "Dec", _
"Overview"))
With SH
.Rows(i).Insert
Set rng = .Range("B" & i + 1).Resize(1, 4)
rng.Copy Destination:=rng(0, 1)
End With
Next SH
End Sub
'<<=============

---
Regards,
Norman


"Rich" wrote in message
...
am trying to get the following code to copy data from the row below the
row
it inserts a new line, instead of the fixed (copy from 17 and paste into
16
as it is at the min

Thanks



For Each sh In Worksheets(Array("Jan", "Feb", "March", "april", "may",
"June", "July", "Aug", "Sep", "Oct", "Nov", "Dec", "Overview"))
sh.Rows(x).Insert
Range("B17:e17").Select
Selection.Copy
Range("B16").Select
ActiveSheet.Paste
Next sh




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default copy and paste from row below

thanks but that only works by copying data from row 17 and inserting it into
16,, i am looking for a way to make the row variable . so if a row is
inserted at 29 it copys the data from 30.. or if a new row in 99 it copies
from 100 ect

is this possible

"chijanzen" wrote:

Rich:

try,

For Each sh In Worksheets(Array("Jan", "Feb", "March", _
"april", "may", "June", "July", "Aug", "Sep", "Oct", "Nov", "Dec",
"Overview"))
With sh
'sh.Rows(x).Insert
.Range("B17:e17").Copy .Range("B16")
End With
Next sh

--
天行健,君*以自強不息
地勢坤,君*以厚德載物

http://www.vba.com.tw/plog/


"Rich" wrote:

am trying to get the following code to copy data from the row below the row
it inserts a new line, instead of the fixed (copy from 17 and paste into 16
as it is at the min

Thanks



For Each sh In Worksheets(Array("Jan", "Feb", "March", "april", "may",
"June", "July", "Aug", "Sep", "Oct", "Nov", "Dec", "Overview"))
sh.Rows(x).Insert
Range("B17:e17").Select
Selection.Copy
Range("B16").Select
ActiveSheet.Paste
Next sh


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default copy and paste from row below

chijanzen:
just curious what you sig is. it only shows up as boxes and takes longer to
download than other posts?

--


Gary


"chijanzen" wrote in message
...
Rich:

try,

For Each sh In Worksheets(Array("Jan", "Feb", "March", _
"april", "may", "June", "July", "Aug", "Sep", "Oct", "Nov", "Dec",
"Overview"))
With sh
'sh.Rows(x).Insert
.Range("B17:e17").Copy .Range("B16")
End With
Next sh

--
???,???????
???,???????

http://www.vba.com.tw/plog/


"Rich" wrote:

am trying to get the following code to copy data from the row below the
row
it inserts a new line, instead of the fixed (copy from 17 and paste into
16
as it is at the min

Thanks



For Each sh In Worksheets(Array("Jan", "Feb", "March", "april", "may",
"June", "July", "Aug", "Sep", "Oct", "Nov", "Dec", "Overview"))
sh.Rows(x).Insert
Range("B17:e17").Select
Selection.Copy
Range("B16").Select
ActiveSheet.Paste
Next sh






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 139
Default copy and paste from row below

Rich:

try,

Const x = 17 'copy row
For Each sh In Worksheets(Array("Jan", "Feb"))
With sh
.Rows(x - 1).Insert
.Range("B" & x).Resize(, 4).Copy .Range("B" & x - 1)
End With
Next sh

--
天行健,君*以自強不息
地勢坤,君*以厚德載物

http://www.vba.com.tw/plog/


"Rich" wrote:

thanks but that only works by copying data from row 17 and inserting it into
16,, i am looking for a way to make the row variable . so if a row is
inserted at 29 it copys the data from 30.. or if a new row in 99 it copies
from 100 ect

is this possible

"chijanzen" wrote:

Rich:

try,

For Each sh In Worksheets(Array("Jan", "Feb", "March", _
"april", "may", "June", "July", "Aug", "Sep", "Oct", "Nov", "Dec",
"Overview"))
With sh
'sh.Rows(x).Insert
.Range("B17:e17").Copy .Range("B16")
End With
Next sh

--
天行健,君*以自強不息
地勢坤,君*以厚德載物

http://www.vba.com.tw/plog/


"Rich" wrote:

am trying to get the following code to copy data from the row below the row
it inserts a new line, instead of the fixed (copy from 17 and paste into 16
as it is at the min

Thanks



For Each sh In Worksheets(Array("Jan", "Feb", "March", "april", "may",
"June", "July", "Aug", "Sep", "Oct", "Nov", "Dec", "Overview"))
sh.Rows(x).Insert
Range("B17:e17").Select
Selection.Copy
Range("B16").Select
ActiveSheet.Paste
Next sh


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
Can't Copy and Paste or Paste Special between Excel Workbooks wllee Excel Discussion (Misc queries) 5 April 29th 23 03:43 AM
Copy; Paste; Paste Special are disabled Mack Neff[_3_] Excel Discussion (Misc queries) 0 April 28th 08 06:29 PM
Excel cut/Paste Problem: Year changes after data is copy and paste Asif Excel Discussion (Misc queries) 2 December 9th 05 05:16 PM
I cannot paste from one workbook to another. Copy works, paste do. JimmyMc Excel Discussion (Misc queries) 1 June 10th 05 03:54 PM
Copy and Paste macro needs to paste to a changing cell reference loulou Excel Programming 0 February 24th 05 10:29 AM


All times are GMT +1. The time now is 08:51 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"