NIce solution but remember to put in some code to deal with Macro's being disabled. In other words the above code relies on macro's not being disabled.
There have been several postings here discussing ways to make sure user has macro's enabled and that should be incorporated here.
Posts by Nimrod
Please note that on 14th December 2023 users will experience an expected outage whilst we make upgrades to our network. We anticipate this process may take a couple of hours and so we apologise in advance for any inconvenience.
-
-
Hello XL'rs .
I'm fairly strong in VBA in excel but have no idea how to write code that will get data from notes in Outlook.I have a folder in outlook with about 100 notes . What I would like to do is import this data one at a time and parse out particular information.
Does anyone have any code for pulling in the information from a folder in outlook ?:puzzled:
-
David:
Thanks for deleting the post about hacking into excel. I'm glad to see you prohibit such material on your site ... Thanks So Much. -
This example assumes the unique value is in A1 of sheet 2 ... and list is on Sheet1 A1:A500
Public Sub FindInList()
On Error GoTo errr:
ValueToFind = Trim(Sheets("Sheet2").Range("A1").Value)
Worksheets("Sheet1").Activate
Worksheets("Sheet1").Range("a1:a500").Find(ValueToFind, LookIn:=xlValues, lookat:=xlWhole).Activate
Exit Sub
errr: pt = MsgBox(ValueToFind & " not found", vbCritical, "Not Found")
End Sub -
Jack ... Thanks for turning me on to this great site !:bouncy:
-
Here's some VBA that might do the trick:
It will sort your active sheet by ColA & ColB then it will remove any rows that have duplicate values in Both A & B.
Public Sub RemoveDupes()
' sort the information
Cells.sort Key1:=Range("A2"), Order1:=xlAscending, Key2:=Range("B2") _
, Order2:=xlAscending, Header:=xlYes, OrderCustom:=1, MatchCase:=False _
, Orientation:=xlTopToBottom'compare and delete
For Rw = Cells(65536, 1).End(xlUp).Row To 2 Step -1
If Cells(Rw, 1).Value = Cells(Rw - 1, 1).Value And _
Cells(Rw, 2).Value = Cells(Rw - 1, 2).Value Then
Cells(Rw, 1).EntireRow.Delete
End If
Next RwEnd Sub