View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default Automatic transfer of row info to another worksheet

The "c" is just a cell in column A

For Each c In rng..............rng has been set to Range("A1:A" & lrow)

lrow has been stored as last row with data in column B

lrow = wsm.Cells(Rows.Count, "B").End(xlUp).Row

Where did you store the code?

Copy this revision to a General Module in your workbook.

Option Explicit
Sub copy_things()
Dim wsm As Worksheet
Dim wsv As Worksheet
Dim c As Range
Dim lrow as Long
Set wsm = Sheets("Master")
Set wsv = Sheets("Vendor's List")

wsm.Select
lrow = wsm.Cells(Rows.Count, "B").End(xlUp).Row
Set rng = Range("A1:A" & lrow)
For Each c In rng
If c = "x" Then
Range(Cells(c.Row, "B"), Cells(c.Row, "H")).Copy
wsv.Cells(Rows.Count, "B").End(xlUp).Offset(1, 0).PasteSpecial
End If
Next c
Application.CutCopyMode = False

End Sub


Gord

On Tue, 26 May 2009 16:04:49 +0100, Jack Wood
wrote:


This is not working. Get an error message indicating that there is a
Compile Error: Invalid Outside Procedure. It will not accept the
command of "Set". Also I am not sure the statement "If C = "x" Then" is
correct. Column A is where the "x" is placed.