Copy cells from two worksheets into one

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

What I have is workbook that has two worksheets with one cell that could be
the same in both worksheets. If that cell has the same information in both
worksheets I would like to create a third worksheet and copy the information
from both of the other two worksheets into the new one.
 
Sub FindTwoThenAddOne()

Dim Rng As Range
Dim Rng2 As Range
Dim Ws3 As Worksheet

Set Rng = ActiveWorkbook.Worksheets(1).Range("A1")
Set Rng2 = ActiveWorkbook.Worksheets(2).Range("A1")

If Rng = Rng2 Then
Set Ws3 = Worksheets.Add(after:=Worksheets(Worksheets.Count))
Ws3.Range("A1") = Rng
End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top