Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
copying an entire column | Excel Programming | |||
Copying entire row | Excel Programming | |||
Copying entire worksheets | Excel Discussion (Misc queries) | |||
Copying an Entire row using an IF Statement | Excel Programming | |||
Macro for copying entire raw | Excel Programming |