MACRO and duplicates

Brown

Board Regular
Joined
Sep 14, 2009
Messages
198
Office Version
  1. 365
Good Morning,
Recently I was helped with an issue and given a solution of this Macro to run.
I am trying to take attendance the following way;
Column A will be all possible attendees
Column B will be all attendees that sign in
Column C will tell me all of the attendees that did not sign in (this is the Macro i was given)

I am good with the Macro on one sheet, and I can even open the Macro (Alt F11) and change the sheet name if i need to.

What i am wondering is this; is there are way to have multiple sheets(tabs), each new sheet will be a date (2-11, 2-13, 2-25, 2-27, 3-3, 3-5, etc...)
Is there a way to have one Macro run each days attendance while keeping the individual sheets named by date?
Will i need to change the Macro on each day to check attendance?

Thanks for the help, and please let me know if i was not very clear so i can explain better.
Brown


Sub LASSO()
Dim Ary As Variant
Dim i As Long

Ary = Sheets("LASSO").Range("b1").CurrentRegion.Value2
With CreateObject("scripting.dictionary")
For i = 2 To UBound(Ary)
If Not Ary(i, 1) = "" Then .Item(Ary(i, 1)) = Empty
Next i
For i = 2 To UBound(Ary)
If .exists(Ary(i, 2)) Then .Remove Ary(i, 2)
Next i
Sheets("LASSO").Range("c2").Resize(.Count).Value = Application.Transpose(.keys)
End With
End Sub
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Do you just want the macro to run on a single sheet, but a different one every day, or do you need it to run on multiple sheets every time?
 
Upvote 0
Each day i will check the attendance, so i will be adding data to another sheet each day. I will need to check the attendance each day.
So, to answer your question, a single sheet, but a different one each day.

Thank you for the help.
Brown
 
Upvote 0
In that case you just need to remove the sheet references, that way the macro will run on the active sheet.
VBA Code:
Sub LASSO()
   Dim Ary As Variant
   Dim i As Long
   
   Ary = Range("b1").CurrentRegion.Value2
   With CreateObject("scripting.dictionary")
      For i = 2 To UBound(Ary)
         If Not Ary(i, 1) = "" Then .Item(Ary(i, 1)) = Empty
      Next i
      For i = 2 To UBound(Ary)
         If .exists(Ary(i, 2)) Then .Remove Ary(i, 2)
      Next i
      Range("c2").Resize(.Count).Value = Application.Transpose(.Keys)
   End With
End Sub
 
Upvote 0
Thank you so much. I will plug this in and make sure i can run it correctly.
Brown
 
Upvote 0
You're welcome, just ensure the sheet you want it to work on is active.
 
Upvote 0
The Macro is running wonderfully, but now i have an additional question.

Once i have run the Macro and have the list of absences i need, is there a way to have those ID Numbers (absent people) cross referenced (highlighted) in another column?

So i have a list of all people that should attend (ID numbers) in column A, then all people that are present in column B, Run the Macro and get a list of all absent people in Column C
What i would like to do is have all people in Column C matched to their name in column M lets say.
How can i get one column to show if it equals something in another column might be a better question?

Thanks
 
Upvote 0
As this is a new question, it needs a new thread. Thanks
 
Upvote 0

Forum statistics

Threads
1,215,730
Messages
6,126,528
Members
449,316
Latest member
sravya

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top