LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default copy entire row, not just cell in row

I've tried adapting code to accomplish copy and pasting from the Sheet "All
Records" to a new Sheet called "Short Names" all rows with 3 characters or
less in the last name of the Name Column which is column D in the All Records
Table. The name format is last name, then a comma, then a space and then the
first name. For Example

Fox, James or Ray, Barbara.

These sheets are part of hte same workbook. I appreciate any help you can
provide. Thanks

Dim rng As Range, cell As Range

Dim i As Long, sh As Worksheet
With Worksheets("All Records")
Set rng = .Range(.Cells(1, 1), _
.Cells(Rows.Count, 1).End(xlUp))
End With
i = 1

Set sh = Worksheets("Short Names")
For Each cell In rng

With sh
Set rng = .Range(.Cells(2, "D"), .Cells(Rows.Count, "D").End(xlUp))
End With


s = Replace(Trim(cell.Value), " ", "")
ipos = InStr(1, s, ",", vbTextCompare)
If ipos <= 4 And ipos < 0 Then
s1 = Left(s, ipos - 1)
sh1.Cells(rw, 1).Value = s1
rw = rw + 1
End If
Next

End Sub
 
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
want to copy entire text box and paste in new cell delbridk Excel Discussion (Misc queries) 4 October 2nd 06 05:33 PM
Copy entire row if.... Biff Excel Programming 9 November 23rd 05 09:21 PM
Copy one cell to entire column Tom Excel Discussion (Misc queries) 3 April 28th 05 03:26 PM
Copy one cell to entire column Tom Excel Discussion (Misc queries) 6 April 27th 05 11:39 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:21 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"