Hi

I want to write the following function using VBA code:

=INDEX($H$1:$H$6,MATCH(A1,$G$1:$G$6,0))

Code is given below

```
Sub Fill_Formula()
Dim rng As Range
Dim sht As Worksheet
Dim Lastrow As Long
Dim Sk As Variant
Set sht = Sheet1
Lastrow = sht.Cells(sht.Rows.Count, "A").End(xlUp).Row 'Finds lastrow for column A,update to whichever one you need
Sk = Application.Index(Sheet1.Range("H1:H6"), Application.Match(Lastrow, Sheet1.Range("G1:G6"), 0), 1)
Set rng = Range("B1:B" & Lastrow) 'Updating column C with formula, change to what you need
rng.Formula = Sk
End Sub
```

Display More
After run above code I can get only H6 value in Col B for all rather than each corresponding value.I would appreciate to solve this problem

[TABLE="border: 0, cellpadding: 0, cellspacing: 0"]

[TD="width: 64"]A[/TD]

[TD="width: 64"]B[/TD]

[TD="width: 76"]C[/TD]

[TD="width: 73"]D[/TD]

[TD="width: 64"]E[/TD]

[TD="width: 64"]F[/TD]

[TD="width: 64"]G[/TD]

[TD="width: 64"]H[/TD]

[TD="align: right"]1[/TD]

Nov-Dec

[/td]

[TD="width: 64"] [/TD]

1

[/td]Jan-Feb

[/td]

[TD="align: right"]2[/TD]

Nov-Dec

[/td]2

[/td]Mar-Apr

[/td]

[TD="align: right"]3[/TD]

Nov-Dec

[/td]3

[/td]May-Jun

[/td]

[TD="align: right"]4[/TD]

Nov-Dec

[/td]4

[/td]Jul-Aug

[/td]

[TD="align: right"]5[/TD]

Nov-Dec

[/td]5

[/td]Sep-Oct

[/td]

[TD="align: right"]6[/TD]

Nov-Dec

[/td]6

[/td]Nov-Dec

[/td]

[/TABLE]

Thanks