Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default copy range code


hello i need to do somthing like this


if(a10,copy range (a1:q1) to sheet1 (a1:q1)



how can i do this plz ?!

now days i make that formula for each cell
like
=if(a10,a1,) if(a10,b1,) ect....

thanks


--
ganja
------------------------------------------------------------------------
ganja's Profile: http://www.thecodecage.com/forumz/member.php?userid=54
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=38215

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default copy range code


Welcome to The Code Cage
A formula can only return a value from a cell it cannot copy anything
to another cell or range, what you want to acheive can only be done in
VBA (Visual Basic for Applications, Microsofts version of VB), if you
cannot use VBA in your workbook you will still have to do it by hand im
afraid!


--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=38215

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default copy range code


yeah that why i asked the code for this one
i should sort that way about 1000 raws
thats really can help me


--
ganja
------------------------------------------------------------------------
ganja's Profile: http://www.thecodecage.com/forumz/member.php?userid=54
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=38215

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default copy range code

Hi,

You posted in programming so I gues you want a macro. Right click the sheet
tab where your source data is, view code and paste this in and run it.

Sub Stantive()
If IsNumeric(Range("A1").Value) And Range("A1").Value 0 Then
Range("a1:Q1").Copy Destination:=Sheets("Sheet1").Range("A1")
End If
End Sub

Mike

"ganja" wrote:


hello i need to do somthing like this


if(a10,copy range (a1:q1) to sheet1 (a1:q1)



how can i do this plz ?!

now days i make that formula for each cell
like
=if(a10,a1,) if(a10,b1,) ect....

thanks


--
ganja
------------------------------------------------------------------------
ganja's Profile: http://www.thecodecage.com/forumz/member.php?userid=54
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=38215


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default copy range code


thanks Mike that works
now how can i make it for all rows a1..a1000 for example ?!
like if(a10,copy range (a1:q1) to sheet1 (a1:q1)
if(a20,copy range (a2:q2) to sheet1 (a2:q2)
if(a30,copy range (a3:q3) to sheet1 (a3:q3)

and maybe the paste gonna be like "next empty raw in sheet1"

like if(a10,copy range (a1:q1) to sheet1 (next empty raw)

thanks again

Mike H;137846 Wrote:
Hi,

You posted in programming so I gues you want a macro. Right click the
sheet
tab where your source data is, view code and paste this in and run it.

Sub Stantive()
If IsNumeric(Range("A1").Value) And Range("A1").Value 0 Then
Range("a1:Q1").Copy Destination:=Sheets("Sheet1").Range("A1")
End If
End Sub

Mike

"ganja" wrote:


hello i need to do somthing like this


if(a10,copy range (a1:q1) to sheet1 (a1:q1)



how can i do this plz ?!

now days i make that formula for each cell
like
=if(a10,a1,) if(a10,b1,) ect....

thanks


--
ganja

------------------------------------------------------------------------
ganja's Profile: 'The Code Cage Forums - View Profile: ganja'

(http://www.thecodecage.com/forumz/member.php?userid=54)
View this thread: 'copy range code - The Code Cage Forums'

(http://www.thecodecage.com/forumz/sh...ad.php?t=38215)




--
ganja
------------------------------------------------------------------------
ganja's Profile: http://www.thecodecage.com/forumz/member.php?userid=54
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=38215



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default copy range code

Hi,

Try the code below. Note that I've now qualified the ranges and assumed your
source data are in sheet1 so change MySheet to suit

Sub Stantive()
MySheet = "Sheet1"
lastrow = Sheets(MySheet).Cells(Cells.Rows.Count, "A").End(xlUp).Row
Set MyRange = Sheets(MySheet).Range("A1:A" & lastrow)
For Each c In MyRange
If IsNumeric(c.Value) And c.Value 0 Then
Set c = c.Resize(, 17)
lastrow = Sheets("Sheet2").Cells(Cells.Rows.Count, "A").End(xlUp).Row
c.Copy Destination:=Sheets("Sheet2").Range("A" & lastrow + 1)
End If
Next
End Sub

Mike

Mike

Sub Stantive()
lastrow = Sheets("Sheet1").Cells(Cells.Rows.Count, "A").End(xlUp).Row
Set MyRange = Sheets("Sheet1").Range("A1:A" & lastrow)
For Each c In MyRange
If IsNumeric(c.Value) And c.Value 0 Then
Set c = c.Resize(, 17)
lastrow = Sheets("Sheet2").Cells(Cells.Rows.Count, "A").End(xlUp).Row
c.Copy Destination:=Sheets("Sheet2").Range("A" & lastrow + 1)
End If
Next
End Sub


"ganja" wrote:


thanks Mike that works
now how can i make it for all rows a1..a1000 for example ?!
like if(a10,copy range (a1:q1) to sheet1 (a1:q1)
if(a20,copy range (a2:q2) to sheet1 (a2:q2)
if(a30,copy range (a3:q3) to sheet1 (a3:q3)

and maybe the paste gonna be like "next empty raw in sheet1"

like if(a10,copy range (a1:q1) to sheet1 (next empty raw)

thanks again

Mike H;137846 Wrote:
Hi,

You posted in programming so I gues you want a macro. Right click the
sheet
tab where your source data is, view code and paste this in and run it.

Sub Stantive()
If IsNumeric(Range("A1").Value) And Range("A1").Value 0 Then
Range("a1:Q1").Copy Destination:=Sheets("Sheet1").Range("A1")
End If
End Sub

Mike

"ganja" wrote:


hello i need to do somthing like this


if(a10,copy range (a1:q1) to sheet1 (a1:q1)



how can i do this plz ?!

now days i make that formula for each cell
like
=if(a10,a1,) if(a10,b1,) ect....

thanks


--
ganja

------------------------------------------------------------------------
ganja's Profile: 'The Code Cage Forums - View Profile: ganja'

(http://www.thecodecage.com/forumz/member.php?userid=54)
View this thread: 'copy range code - The Code Cage Forums'

(http://www.thecodecage.com/forumz/sh...ad.php?t=38215)




--
ganja
------------------------------------------------------------------------
ganja's Profile: http://www.thecodecage.com/forumz/member.php?userid=54
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=38215


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default copy range code

Oops,

There's 2 lots of code there I pasted a version in and changed my mind and
forgot to delete. This is the correct version. It copies from sheet 1 to
sheet 2 so if that's incorrect change SrcSheet and dstSheet to the correct
names

Sub Stantive()
srcSheet = "Sheet1"
dstSheet = "Sheet2"
lastrow = Sheets(srcSheet).Cells(Cells.Rows.Count, "A").End(xlUp).Row
Set MyRange = Sheets(srcSheet).Range("A1:A" & lastrow)
For Each c In MyRange
If IsNumeric(c.Value) And c.Value 0 Then
Set c = c.Resize(, 17)
lastrow = Sheets(dstSheet).Cells(Cells.Rows.Count, "A").End(xlUp).Row
c.Copy Destination:=Sheets(dstSheet).Range("A" & lastrow + 1)
End If
Next
End Sub

Mike

"Mike H" wrote:

Hi,

Try the code below. Note that I've now qualified the ranges and assumed your
source data are in sheet1 so change MySheet to suit

Sub Stantive()
MySheet = "Sheet1"
lastrow = Sheets(MySheet).Cells(Cells.Rows.Count, "A").End(xlUp).Row
Set MyRange = Sheets(MySheet).Range("A1:A" & lastrow)
For Each c In MyRange
If IsNumeric(c.Value) And c.Value 0 Then
Set c = c.Resize(, 17)
lastrow = Sheets("Sheet2").Cells(Cells.Rows.Count, "A").End(xlUp).Row
c.Copy Destination:=Sheets("Sheet2").Range("A" & lastrow + 1)
End If
Next
End Sub

Mike

Mike

Sub Stantive()
lastrow = Sheets("Sheet1").Cells(Cells.Rows.Count, "A").End(xlUp).Row
Set MyRange = Sheets("Sheet1").Range("A1:A" & lastrow)
For Each c In MyRange
If IsNumeric(c.Value) And c.Value 0 Then
Set c = c.Resize(, 17)
lastrow = Sheets("Sheet2").Cells(Cells.Rows.Count, "A").End(xlUp).Row
c.Copy Destination:=Sheets("Sheet2").Range("A" & lastrow + 1)
End If
Next
End Sub


"ganja" wrote:


thanks Mike that works
now how can i make it for all rows a1..a1000 for example ?!
like if(a10,copy range (a1:q1) to sheet1 (a1:q1)
if(a20,copy range (a2:q2) to sheet1 (a2:q2)
if(a30,copy range (a3:q3) to sheet1 (a3:q3)

and maybe the paste gonna be like "next empty raw in sheet1"

like if(a10,copy range (a1:q1) to sheet1 (next empty raw)

thanks again

Mike H;137846 Wrote:
Hi,

You posted in programming so I gues you want a macro. Right click the
sheet
tab where your source data is, view code and paste this in and run it.

Sub Stantive()
If IsNumeric(Range("A1").Value) And Range("A1").Value 0 Then
Range("a1:Q1").Copy Destination:=Sheets("Sheet1").Range("A1")
End If
End Sub

Mike

"ganja" wrote:


hello i need to do somthing like this


if(a10,copy range (a1:q1) to sheet1 (a1:q1)



how can i do this plz ?!

now days i make that formula for each cell
like
=if(a10,a1,) if(a10,b1,) ect....

thanks


--
ganja

------------------------------------------------------------------------
ganja's Profile: 'The Code Cage Forums - View Profile: ganja'
(http://www.thecodecage.com/forumz/member.php?userid=54)
View this thread: 'copy range code - The Code Cage Forums'
(http://www.thecodecage.com/forumz/sh...ad.php?t=38215)




--
ganja
------------------------------------------------------------------------
ganja's Profile: http://www.thecodecage.com/forumz/member.php?userid=54
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=38215


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default copy range code


thanks all
i thought it will be easy for me to understand how to change the code
after i got it , but hell no :)
the colum i need to check is CP* 0
and on the CP cell i have formula =IF(CO*0[text],1,)
in that way i get result 1 if the CO* cell isnt empty (thats why i
asked to code a0)
if there is an option to make it shorter and make if CO* has somthing
written
then copy all the raw to for example sheet2 next empty raw


Simon Lloyd ur code has some Error

thanks again im happy i found this forum i'll take ur help many times
:)


--
ganja
------------------------------------------------------------------------
ganja's Profile: http://www.thecodecage.com/forumz/member.php?userid=54
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=38215

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default copy range code


Not tested but this should do it:

Code:
--------------------
Sub Stantive()
Dim i As Long
For i = 1 To Range("A").Rows.Count
If IsNumeric(Range("A" & i).Value) And Range("A" & i).Value 0 Then
Range("A" & i & ":" & "Q" & i).Copy Destination:=Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
End If
Next i
End Sub
--------------------


--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=38215

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
code to copy range smith82 Excel Worksheet Functions 1 May 2nd 10 02:27 PM
VBA Code- Copy & Paste in Blank Range Youlan Excel Discussion (Misc queries) 9 March 27th 08 03:22 PM
Can anyone tell me the proper code to copy a range... Steel Works, Inc. Excel Programming 1 March 13th 07 12:24 AM
Code to copy formula to variable range Snowsride Excel Programming 4 November 3rd 05 09:41 PM
Code to copy range vs Copy Entire Worksheet - can't figure it out Mike Taylor Excel Programming 1 April 15th 04 08:34 PM


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