Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Copying an entire row

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!
  #2   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default Copying an entire row

Worksheets("sheet1").Cells(CountA, 1).EntireRow.Copy _
Worksheets("sheet3").Cells(CountA, 1)


"smitty24" wrote:

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!

  #3   Report Post  
Posted to microsoft.public.excel.programming
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!



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
copying an entire column dlb[_8_] Excel Programming 4 March 16th 06 03:34 PM
Copying entire row Sylvia[_11_] Excel Programming 1 January 12th 06 03:57 AM
Copying entire worksheets Todd Nelson Excel Discussion (Misc queries) 2 August 31st 05 06:50 PM
Copying an Entire row using an IF Statement Marcus Excel Programming 2 July 5th 04 03:19 PM
Macro for copying entire raw Mac[_5_] Excel Programming 3 November 13th 03 03:09 AM


All times are GMT +1. The time now is 04:06 AM.

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"