LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Compare two sheets, then copy/paste if different

A short time ago I was getting help with a macro that created a new sheet,
and named it €˜Analysis-Sheet. Then, I copied everything from a sheet named
€˜Analysis of Interest Prior to the €˜Analysis-Sheet. The code is below:


Dim EntireRange As Long
'Delete the sheet "Summary-Sheet" if it exist
Application.DisplayAlerts = False
On Error Resume Next
ThisWorkbook.Worksheets("Analysis-Sheet").Delete
On Error GoTo 0
Application.DisplayAlerts = True

'Add a worksheet with the name "Summary-Sheet"
Set Basebook = ThisWorkbook
Set Newsh = Basebook.Worksheets.Add
Newsh.Name = "Analysis"

Dim ws1 As Worksheet, ws2 As Worksheet
Dim lngRow As Long, lngFRow As Long

Set ws1 = Worksheets("Analysis of Interest Prior")
Set ws2 = Worksheets("Analysis of Interest Current")

ws1.Copy After:=ws2
Set ws1 = ActiveSheet
ActiveSheet.Name = "Analysis-Sheet"

ws1.Columns("F:J").Clear

Jacob Skaria helped mw with some of the code above.

Now, I am trying to compare the values in Column A of €˜Analysis-Sheet
(these values came from €˜Analysis of Interest Prior) with the values in
Column A of €˜Analysis of Interest Current. Then, I want to copy past the
entire row from €˜Analysis of Interest Current if the value in Column A is
not in Column A of €˜Analysis of Interest Prior. The purpose of this is that
some new accounts are added to €˜Analysis of Interest Current from time to
time, and I want to be able to pick up these new accounts in my analysis.
For instance, I have account number 7250-0000 in both 'Analysis of Interest
Prior' and 'Analysis of Interest Current', also, I have account number
7252-0000 in both 'Analysis of Interest Prior' and 'Analysis of Interest
Current'. However, I account number 7254-0000 and account number 7255-0000
only appear in 'Analysis of Interest Current', so I'd like to take copy all
contents from both rows from 'Analysis of Interest Current' and place it
under the end of the list of account numbers in 'Analysis-Sheet'. How can I
do this?

Ryan---


--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.
 
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
Compare and copy/paste Rockbear Excel Worksheet Functions 1 October 10th 08 09:45 PM
Compare col and match then copy and paste saman110 via OfficeKB.com Excel Discussion (Misc queries) 2 February 21st 08 12:28 AM
Compare two wk sheets with common data using copy paste macro conejo Excel Worksheet Functions 0 October 8th 07 09:21 AM
Compare two Sheets and copy value sa02000 Excel Worksheet Functions 1 May 3rd 06 01:51 PM
Compare,copy and paste if true light Excel Programming 0 August 6th 05 04:59 PM


All times are GMT +1. The time now is 01:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"