Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 24
Default copy cell only with contains

hi,
how to create macro for me to copy only cell with contains.
let say range from a1 to c8.
1st copy let say a1 to c4 only have cotains value and for next copy the
value at
a1 to c6.
the contains of cell keep on changing but within a1 to c8.

how to do this,...
thanks in advance....

  #2   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 11,058
Default copy cell only with contains

This will copy only the non-blanks cells from Sheet1 to Sheet2:

Sub CopyStuff()
Dim s1 As Worksheet
Dim s2 As Worksheet
Set s1 = Sheets("Sheet1")
Set s2 = Sheets("Sheet2")
For Each r In s1.Range("A1:C8")
If r.Value = "" Then
Else
r.Copy s2.Range(r.Address)
End If
Next
End Sub

--
Gary''s Student - gsnu200858


"ramzi" wrote:

hi,
how to create macro for me to copy only cell with contains.
let say range from a1 to c8.
1st copy let say a1 to c4 only have cotains value and for next copy the
value at
a1 to c6.
the contains of cell keep on changing but within a1 to c8.

how to do this,...
thanks in advance....

  #3   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 1,104
Default copy cell only with contains

It might help if you gave example of the data and what determines if it is
to be copied, and where it is to be copied
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email


"ramzi" wrote in message
...
hi,
how to create macro for me to copy only cell with contains.
let say range from a1 to c8.
1st copy let say a1 to c4 only have cotains value and for next copy the
value at
a1 to c6.
the contains of cell keep on changing but within a1 to c8.

how to do this,...
thanks in advance....


  #4   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 24
Default copy cell only with contains

HI, my macro as below......

In sheet2 I want the 2nd paste data will store next after my 1st paste data...
can u help me on this...


Sub CopyStuff()
Dim s1 As Worksheet
Dim s2 As Worksheet
Set s1 = Sheets("Sheet1")
Set s2 = Sheets("Sheet2")
For Each r In s1.Range("A1:C8")
If r.Value = "" Then
Else
r.Copy s2.Range(r.Address)
lastrow = Sheets("Sheet2").Cells(Cells.Rows.Count, "A").End(xlUp).Row + 1
Sheets("Sheet2").Range("A" & lastrow).PasteSpecial Paste:=xlPasteValues,
Operation:=xlNone, SkipBlanks:=False, Transpose:=False

End If
Next
End Sub


"Gary''s Student" wrote:

This will copy only the non-blanks cells from Sheet1 to Sheet2:

Sub CopyStuff()
Dim s1 As Worksheet
Dim s2 As Worksheet
Set s1 = Sheets("Sheet1")
Set s2 = Sheets("Sheet2")
For Each r In s1.Range("A1:C8")
If r.Value = "" Then
Else
r.Copy s2.Range(r.Address)
End If
Next
End Sub

--
Gary''s Student - gsnu200858


"ramzi" wrote:

hi,
how to create macro for me to copy only cell with contains.
let say range from a1 to c8.
1st copy let say a1 to c4 only have cotains value and for next copy the
value at
a1 to c6.
the contains of cell keep on changing but within a1 to c8.

how to do this,...
thanks in advance....

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
Copy last cell with data in column E on one sheet to cell on anoth Seahawk Excel Worksheet Functions 7 May 7th 09 02:52 AM
Copy Word cell containing Shift/Enter to Excel.Keep it as 1 cell Nancy Vazquez Excel Discussion (Misc queries) 0 April 1st 09 07:05 PM
How can I copy a value from a cell and paste it into another cell while adding it to the previous value in that cell [email protected] Excel Worksheet Functions 2 November 7th 07 09:39 AM
I copy a formula and the results copy from the original cell brooklynsd Excel Discussion (Misc queries) 1 June 23rd 07 01:35 AM
Select cell, Copy it, Paste it, Return to Previous cell spydor Excel Discussion (Misc queries) 1 December 30th 05 01:29 PM


All times are GMT +1. The time now is 11:27 AM.

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

About Us

"It's about Microsoft Excel"