#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 58
Default Copy data

Hi all I am wondering how to change this code to copy values. The trouble is
at the moment it is copying the code and causing the error code on the
cells.
sub copydata()

Dim rng As Range, cell As Range, col As Long
Dim rw As Long
col = 5
rw = 1
With Worksheets("list")
Set rng = .Range(.Cells(1, col), .Cells(Rows.Count, col).End(xlUp))
End With
For Each cell In rng
If LCase(cell.Value) = "yes" Then
cell.EntireRow.Copy Destination:=Worksheets("fortnight") _
.Cells(rw, 1)
rw = rw + 1
End If
Next

end sub

Thanks in advance

Greg


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Copy data

try it this way.Change to suit

Sub copyifyes()
With Sheets("list")
col = 5
Set rng = .Range(.Cells(1, col), .Cells(Rows.Count, col).End(xlUp))
For Each c In rng
If LCase(c.Value) = "yes" Then
x = Sheets("Bill").Cells(Rows.Count, 1).End(xlUp).Row + 1
c.EntireRow.Copy Sheets("fortnight").Cells(x, 1)
End If
Next c
End With
End Sub

--
Don Guillett
SalesAid Software

"Greg" wrote in message
...
Hi all I am wondering how to change this code to copy values. The trouble

is
at the moment it is copying the code and causing the error code on the
cells.
sub copydata()

Dim rng As Range, cell As Range, col As Long
Dim rw As Long
col = 5
rw = 1
With Worksheets("list")
Set rng = .Range(.Cells(1, col), .Cells(Rows.Count, col).End(xlUp))
End With
For Each cell In rng
If LCase(cell.Value) = "yes" Then
cell.EntireRow.Copy Destination:=Worksheets("fortnight") _
.Cells(rw, 1)
rw = rw + 1
End If
Next

end sub

Thanks in advance

Greg




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 58
Default Copy data

Thank you Don

Greg


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
How copy none excel data & paste in 2007 without overwriting data Wakefootin Excel Discussion (Misc queries) 2 October 8th 09 12:15 AM
filted data, copy and paste a col. puts data in wrong row how fix chris_fig New Users to Excel 1 October 16th 06 04:26 PM
Retrieve multiple data rows data from a very long list and copy t mathew Excel Discussion (Misc queries) 1 September 13th 06 08:24 PM
How do I copy data from main frame computer and keep data in cell Doug Excel Worksheet Functions 1 May 30th 06 05:15 PM
Copy old Data from web query while keeping previous days data DRobidoux Excel Worksheet Functions 0 March 22nd 06 01:56 PM


All times are GMT +1. The time now is 09:30 PM.

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"