Skip to main content
Support is Offline
Today is our off day. We are taking some rest and will come back stronger tomorrow
Official support hours
Monday To Friday
From 09:00 To 17:30
  Tuesday, 14 March 2023
  0 Replies
  1.2K Visits
0
Votes
Undo
I am using Excel 2013,

I apply 2 way the Large Formula VBA, but not working, what i am wrong, i don't know

Sub Macro1()
'1st Table Dim statement ---> Declares variables
Dim lRow As Long, lCol As Long
lRow = Range("D5").End(xlDown).Row
lCol = Range("C5").End(xlToRight).Column

'Column Count in Number
Dim k As Long, m As Long
k = Range("C5", Range("C5").End(xlToRight)).Columns.Count
'Row Count in Number
m = Range("D6", Range("D6").End(xlDown)).Rows.Count

Dim MyRange As Range
Set MyRange = Range(Range("D5").Offset(1, k + 3), Range("D5").Offset(m, k + 3))

Range("D5").Offset(2, 1 + 3).Formula = "=LARGE(" & MyRange & ",1)"

'And

'=(LARGE($I$6:$I$12,1)-I7)/2
Range("D5").Offset(2, 1 + 3).Formula = "=(LARGE(" & MyRange & ",1)-" & Range("D5").Offset(1, k + 3) & ")/2"

End Sub

Kindy help me and Thanks for advance
There are no replies made for this post yet.