473,396 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Advice on how to start on my code

Hi all,

I've been tasked to write a macro that will compare 2 different worksheet. The first worksheet contains the past employee list, whereas the second worksheet contains the current employee list as of today.

The main idea for the macro is that it will look through both lists and identify the new and current employees. The current employees will be inserted into a new worksheet and the new employees will be inserted into another worksheet.

I'm looking for something similar to SQL's
Expand|Select|Wrap|Line Numbers
  1. SELECT * 
  2. FROM Past 
  3. WHERE Current.ID LIKE Past.ID
&
Expand|Select|Wrap|Line Numbers
  1. SELECT *
  2. FROM Past
  3. WHERE Current.ID NOT LIKE Past.ID
Whereby it will insert the entire row into the new worksheets.

Any advice on which function that I should be looking at?
Jan 29 '15 #1
4 878
Rabbit
12,516 Expert Mod 8TB
No functions needed, assuming the spreadsheets are linked in the database, you can just use a query with an outer join.
Jan 29 '15 #2
I don't think the spreadsheets are linked to any database. Is there any other way I can go about doing this without linking the spreadsheets to an sql server?
Jan 29 '15 #3
jforbes
1,107 Expert 1GB
In Access, on the ribbon, select External Data then click Excel. From there you can Link to Excel Spreadsheets and they will be query-able just like a native table.
Jan 29 '15 #4
Hi guys, thanks for all your input! Really appreciate it :)

I found a way to do it without linking the spreadsheets though, I used record macro to input this a new column with this code
Expand|Select|Wrap|Line Numbers
  1. ActiveCell.FormulaR1C1 = _
  2.         "=IF(ISERROR(MATCH(C[-50],Sheet1!C[-50],0)),"""",""Duplicate"")"
With that code, I recorded another macro that will filter out all the rows with "Duplicate" and copy and paste them in a new spreadsheet. Same goes for the non-duplicates.
Jan 30 '15 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: John Allison | last post by:
Hi everybody I'm very new to python so please forgive any idiotic mistakes: I'm writing a MUD-like text game in python and I want to support dynamic ingame scripting to deal with user commands. I...
2
by: dmiller23462 | last post by:
Hey guys, I'm back again....I've got the results displaying that I wanted but instead of having a "next" or "previous" link displayed I am getting the error msg below (I actually get the data that...
10
by: Tempy | last post by:
Hi Keith, below is my code to hide the boxes and txt and button for 3 people, is there a shorter way to write this ? Private Sub Form_Current() If LastName = "Franz" Then Me!Supplier1.Visible =...
4
by: AW | last post by:
Hello, I have a method to initialize my application, which reads configuration settings, establishes connections, and loads a bunch of data. It lasts for several seconds. This method is...
0
by: rcolby | last post by:
Hi, A little advice on code sharing across projects, namespaces and dll's for references. I've got an application that is split between three different projects (one for a service, one for...
0
by: sandi | last post by:
I have Parent child table as decribe below: Parent Table name = TESTPARENT 1. counter bigint isIdentity=Yes Increment=1 Seed=1 2. customer nChar(10) Child Table name = TESTCHILD...
6
by: Leonel Galán | last post by:
When doing Process.Start(), I get "The parameter is invalid" Win32Exception when opening a particular exe. This exe works good in Windows (cmd.exe). The exe is "SPIM.exe" as the Simulator for...
2
by: babe6776 | last post by:
Computer - Dell Dimension 3100 Windows XP SP2 Media centre When we bought our computer the sound drivers weren't properly loaded, so my husband reloaded them from the internet. The sound has...
3
by: anthonykallay | last post by:
Hi there, I am building a website for a group that has 4 companies under it. The sites are fairly similar so i want to be able to use the same set of code in the App_Code folder.. I also want to...
8
by: JimmyFly | last post by:
Hello, I have a form that will be used to display data from a table using 'Dlookup' based on what is entered into a textbox. I can get it to work by callng the code via a form button, but wanted to...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.