PC Review


Reply
Thread Tools Rate Thread

copy range using

 
 
BrianW
Guest
Posts: n/a
 
      27th Mar 2009
In the code below I want cell A3272 in Range("A10:A3272") to be determined
by a cell value of 3 in column L in Sheet(RSum). This cell with value 3 is
constantly moving as rows are to Sheets(RSum). Range "A9:L9" has formulas
linked directly to cells in Sheet(RSUM) so I want to copy down to the value
of 3.
Just to mention there is data after (RSum) A3272 that I dont want showing in
Sheets("Print").

Application.CutCopyMode = False
Sheets("Print").Select
Range("A9:L9").Select
Selection.Copy
Range("A10:A3272").Select
ActiveSheet.Paste
Range("B9").Select
Application.CutCopyMode = True
End Sub
 
Reply With Quote
 
 
 
 
joel
Guest
Posts: n/a
 
      27th Mar 2009
with sheets("RSum)
set c = .Columns("C").find(What:=3, _
lookin:=xlvalues,lookat:=xlwhole)
if c is nothing then
msgbox("Cannot find the value 3")
else
LastRow = c.row
Sheets("Print").Range("A9:L9").Copy
Destination:= .Range("A10:A" & LastRow)
end with

"BrianW" wrote:

> In the code below I want cell A3272 in Range("A10:A3272") to be determined
> by a cell value of 3 in column L in Sheet(RSum). This cell with value 3 is
> constantly moving as rows are to Sheets(RSum). Range "A9:L9" has formulas
> linked directly to cells in Sheet(RSUM) so I want to copy down to the value
> of 3.
> Just to mention there is data after (RSum) A3272 that I dont want showing in
> Sheets("Print").
>
> Application.CutCopyMode = False
> Sheets("Print").Select
> Range("A9:L9").Select
> Selection.Copy
> Range("A10:A3272").Select
> ActiveSheet.Paste
> Range("B9").Select
> Application.CutCopyMode = True
> End Sub

 
Reply With Quote
 
BrianW
Guest
Posts: n/a
 
      27th Mar 2009
Hi Joel
Thank you for your reply
I should of mentioned I'm a real novice at this. When I replace my code with
yours the first row - with sheets("RSum) and Destination:= .Range("A10:A" &
LastRow) change color to red. Do I need to add more code?

Cheers

"joel" wrote:

> with sheets("RSum)
> set c = .Columns("C").find(What:=3, _
> lookin:=xlvalues,lookat:=xlwhole)
> if c is nothing then
> msgbox("Cannot find the value 3")
> else
> LastRow = c.row
> Sheets("Print").Range("A9:L9").Copy
> Destination:= .Range("A10:A" & LastRow)
> end with
>
> "BrianW" wrote:
>
> > In the code below I want cell A3272 in Range("A10:A3272") to be determined
> > by a cell value of 3 in column L in Sheet(RSum). This cell with value 3 is
> > constantly moving as rows are to Sheets(RSum). Range "A9:L9" has formulas
> > linked directly to cells in Sheet(RSUM) so I want to copy down to the value
> > of 3.
> > Just to mention there is data after (RSum) A3272 that I dont want showing in
> > Sheets("Print").
> >
> > Application.CutCopyMode = False
> > Sheets("Print").Select
> > Range("A9:L9").Select
> > Selection.Copy
> > Range("A10:A3272").Select
> > ActiveSheet.Paste
> > Range("B9").Select
> > Application.CutCopyMode = True
> > End Sub

 
Reply With Quote
 
BrianW
Guest
Posts: n/a
 
      28th Mar 2009
Joel
I have managed to get the code working


With Sheets("RSum")
Set c = .Columns("O").Find(What:=3, _
LookIn:=xlValues, lookat:=xlWhole)
If c Is Nothing Then
MsgBox ("Cannot find the value 3")
Else
LastRow = c.Row
Sheets("Print").Range("A9:L9").Copy
Destination = .Range("A10:A" & LastRow)

' Application.CutCopyMode = False
' Sheets("Print").Select
' Range("A9:L9").Select
' Selection.Copy
' Range("A10:A3272").Select
' ActiveSheet.Paste
Range("B9").Select
' Application.CutCopyMode = True
End If
End With
End Sub
End Sub

However works to selecting Sheets("Print").Range("A9:L9") but doesn't copy
down

Cheers bw

"joel" wrote:

> with sheets("RSum)
> set c = .Columns("C").find(What:=3, _
> lookin:=xlvalues,lookat:=xlwhole)
> if c is nothing then
> msgbox("Cannot find the value 3")
> else
> LastRow = c.row
> Sheets("Print").Range("A9:L9").Copy
> Destination:= .Range("A10:A" & LastRow)
> end with
>
> "BrianW" wrote:
>
> > In the code below I want cell A3272 in Range("A10:A3272") to be determined
> > by a cell value of 3 in column L in Sheet(RSum). This cell with value 3 is
> > constantly moving as rows are to Sheets(RSum). Range "A9:L9" has formulas
> > linked directly to cells in Sheet(RSUM) so I want to copy down to the value
> > of 3.
> > Just to mention there is data after (RSum) A3272 that I dont want showing in
> > Sheets("Print").
> >
> > Application.CutCopyMode = False
> > Sheets("Print").Select
> > Range("A9:L9").Select
> > Selection.Copy
> > Range("A10:A3272").Select
> > ActiveSheet.Paste
> > Range("B9").Select
> > Application.CutCopyMode = True
> > End Sub

 
Reply With Quote
 
joel
Guest
Posts: n/a
 
      28th Mar 2009
There are to w posible causes

1) LastRow isn't being set properly. Add a message box

msgbox(LastRow)

I don't think this is the reason.

2) Your Ranges are wrong

Sheets("Print").Range("A9:L9").Copy
Destination = .Range("A10:A" & LastRow)

Do you really want this? I just copied your code.

Sheets("Print").Range("A9:L9").Copy
Destination = .Range("A" & LastRow & :L" & LastRow)

or this

Sheets("Print").Range("A9").Copy
Destination = .Range("A10:A" & LastRow)



"BrianW" wrote:

> Joel
> I have managed to get the code working
>
>
> With Sheets("RSum")
> Set c = .Columns("O").Find(What:=3, _
> LookIn:=xlValues, lookat:=xlWhole)
> If c Is Nothing Then
> MsgBox ("Cannot find the value 3")
> Else
> LastRow = c.Row
> Sheets("Print").Range("A9:L9").Copy
> Destination = .Range("A10:A" & LastRow)
>
> ' Application.CutCopyMode = False
> ' Sheets("Print").Select
> ' Range("A9:L9").Select
> ' Selection.Copy
> ' Range("A10:A3272").Select
> ' ActiveSheet.Paste
> Range("B9").Select
> ' Application.CutCopyMode = True
> End If
> End With
> End Sub
> End Sub
>
> However works to selecting Sheets("Print").Range("A9:L9") but doesn't copy
> down
>
> Cheers bw
>
> "joel" wrote:
>
> > with sheets("RSum)
> > set c = .Columns("C").find(What:=3, _
> > lookin:=xlvalues,lookat:=xlwhole)
> > if c is nothing then
> > msgbox("Cannot find the value 3")
> > else
> > LastRow = c.row
> > Sheets("Print").Range("A9:L9").Copy
> > Destination:= .Range("A10:A" & LastRow)
> > end with
> >
> > "BrianW" wrote:
> >
> > > In the code below I want cell A3272 in Range("A10:A3272") to be determined
> > > by a cell value of 3 in column L in Sheet(RSum). This cell with value 3 is
> > > constantly moving as rows are to Sheets(RSum). Range "A9:L9" has formulas
> > > linked directly to cells in Sheet(RSUM) so I want to copy down to the value
> > > of 3.
> > > Just to mention there is data after (RSum) A3272 that I dont want showing in
> > > Sheets("Print").
> > >
> > > Application.CutCopyMode = False
> > > Sheets("Print").Select
> > > Range("A9:L9").Select
> > > Selection.Copy
> > > Range("A10:A3272").Select
> > > ActiveSheet.Paste
> > > Range("B9").Select
> > > Application.CutCopyMode = True
> > > End Sub

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy Range and Assign a Defined Name to the Pasted Range sgltaylor Microsoft Excel Programming 3 5th Dec 2009 12:47 PM
Copy range from Sheet1 into empty range in Sheet2 Buddy Microsoft Excel Programming 1 19th Aug 2009 12:07 AM
RANGE EXCEL copy cell that meets criteria in a range confused Microsoft Excel Worksheet Functions 3 27th Mar 2008 01:41 PM
How do I edit a selected range then copy the range into an new sheet??? dwyborn Microsoft Excel Programming 2 16th Dec 2005 04:11 PM
Create/copy combo boxes in one range if condition is met in a different range LB Microsoft Excel Programming 4 30th Sep 2005 12:21 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:20 AM.