View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Rick Hansen Rick Hansen is offline
external usenet poster
 
Posts: 104
Default Copying an entire row

Here Smitty,

Here is some code that should get you started to slove your problem..

enjoy, Rick


Sub copyRow()
Dim countA As Long, countB As Long
Dim ws1 As Worksheet, ws2 As Worksheet, ws3 As Worksheet

countA = 3
countB = 3
Set ws1 = Worksheets("Sheet1")
Set ws2 = Worksheets("Sheet2")
Set ws3 = Worksheets("Sheet3")

If ws1.Cells(countA, 1) = ws2.Cells(countB, 1) Then
ws1.Range("A" & countA).EntireRow.Copy Destination:=ws3.Cells(countA, 1)
End If
End Sub




"smitty24" wrote in message
...
I have an IF statement that compares a particular cell in two different
worksheets.

If Worksheets("sheet1").Cells(CountA, 1) =
Worksheets("sheet2").Cells(CountB, 1)

If my statement is true, how do I copy the entire row in which
cells(CountA,1) resides in on "sheet1" to a new worksheet "sheet3" in the

row
that (CountA,1) is located on?

Thanks!