![]() |
|
|||||||
|
|
Thread Tools | Display Modes |
|
#5
|
||||
|
||||
|
Probably not
That may depend on how big the two ranges are and the arrangement of your data. What version of Excel are you using? If MS365 then you can put a temporary formula at the bottom of the existing list of the active sheet, then convert the results of that formula to plain values: Code:
Sub blah()
Set SourceSht = Workbooks("Book2").Sheets("Sheet1") 'adjust this so that SourceSht is your source sheet.
With SourceSht
Set RngSource = Range(.Range("C2"), .Cells(.Rows.Count, "C").End(xlUp)) 'this is your source data range; adjust C2 to the top cell of that range.
'SourceAddress = RngSource.Address(external:=True) 'for the .formula2 version below.
SourceAddressR1C1 = RngSource.Address(, , xlR1C1, external:=True) 'for the .Formula2R1C1 version below.
End With
With ActiveSheet
Set DestnCell = .Cells(.Rows.Count, "C").End(xlUp).Offset(1) 'this is the single cell where the formula will go.
Set RngExisting = .Range(.Range("C3"), DestnCell.Offset(-1)) 'this is your existing data on the active sheet, adjust C3 to the top cell of your data.
'ExistingAddress = RngExisting.Address 'for the .formula2 version below.
ExistingAddressR1C1 = RngExisting.Address(, , xlR1C1) 'for the .Formula2R1C1 version below.
End With
'choose one of these lines below:
'*********************************
DestnCell.Formula2R1C1 = "=LET(a," & SourceAddressR1C1 & ",FILTER(a,(ISERROR(MATCH(a," & ExistingAddressR1C1 & ",0)))*(a<>"""")))"
'DestnCell.Formula2 = "=LET(a," & SourceAddress & ",FILTER(a,(ISERROR(MATCH(a," & ExistingAddress & ",0)))*(a<>"""")))"
'*********************************
'Convert results to plain values:
If DestnCell.SpillingToRange Is Nothing Then
If IsError(DestnCell) Then DestnCell.ClearContents Else DestnCell.Value = DestnCell.Value
Else
DestnCell.SpillingToRange.Value = DestnCell.SpillingToRange.Value
End If
End Sub
Older versions of Excel: Code:
Sub blah2()
Set SourceSht = Workbooks("Book2").Sheets("Sheet1") 'adjust this so that SourceSht is your source sheet.
With SourceSht
RngSource = Range(.Range("C2"), .Cells(.Rows.Count, "C").End(xlUp)).Value 'this is your source data; adjust C2 to the top cell of that range.
End With
With ActiveSheet
Set DestnCell = .Cells(.Rows.Count, "C").End(xlUp).Offset(1) 'this is the single cell where the results will begin.
RngExisting = .Range(.Range("C3"), DestnCell.Offset(-1)).Value 'this is your existing data on the active sheet, adjust C3 to the top cell of your data.
End With
For Each v In RngSource
If Not IsEmpty(v) Then
If Len(Application.Trim(v)) > 0 Then
xx = Application.Match(v, RngExisting, 0)
If IsError(xx) Then
DestnCell.Value = v
Set DestnCell = DestnCell.Offset(1)
End If
End If
End If
Next v
End Sub
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Display workbook filename in title bar and use personal workbook | Jamal NUMAN | Excel Programming | 3 | 08-04-2022 02:56 AM |
| How do I copy a workbook to another workbook and keep the formatting within the new workbook | excelforsue | Excel | 3 | 09-15-2020 03:37 AM |
| data entered in one workbook should be updated in other relevant workbook based on the date | vedha | Excel | 0 | 04-24-2015 08:45 PM |
| Workbook with daily active sheet | MDMeyers | Excel | 1 | 01-10-2015 04:48 AM |
| Range(Cell1,Cell2) Error on another workbook controlling some other workbook? | tinfanide | Excel Programming | 1 | 02-09-2012 04:08 PM |