Amend Code to work in earlier versions

howard

Well-known Member
Joined
Jun 26, 2006
Messages
6,563
Office Version
  1. 2021
Platform
  1. Windows
I have Code below that works 100% in Office 2021, but not in Excel 2010

Kindly amend code, so that it will work on earlier versions as well

I know that Formula2R1C1 need to change to Formula1R1C1, but don't know how to replace Unique with a formula in Office 2010 that will generate same result

Kindly amend my code

Code:
 Sub Formula()
Dim LR As Long
With Sheets("Howard")
LR = .Cells(.Rows.Count, "L").End(xlUp).Row

.Range("E12:E" & LR + 14).ClearContents
.Range("e12").Formula2R1C1 = "=UNIQUE(R[-11]C[9]:R[2]C[9])"
.Range("e12:E" & LR + 14).Copy
.Range("E12:E" & LR + 14).PasteSpecial xlValues

End With
Application.CutCopyMode = False
End Sub
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Untested but try the code below

VBA Code:
Sub FormulaEnter()
    Dim LR As Long
   
    With Sheets("Howard")
        LR = .Cells(.Rows.Count, "L").End(xlUp).Row

        With .Range("E12:E" & LR + 14)
            .ClearContents
            .FormulaR1C1 = "=IFERROR(INDEX(R1C14:R14C14, MATCH(0, INDEX(COUNTIF(R11C5:R[-1]C5, R1C14:R14C14), 0, 0), 0)), """")"
            .Value = .Value
        End With
   
    End With

End Sub

Btw, I personally wouldn't name a Sub the same as a word VBA uses
 
Upvote 0
Solution

Forum statistics

Threads
1,215,086
Messages
6,123,038
Members
449,092
Latest member
ikke

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