How can apply "LastRow" in the formula

motilulla

Well-known Member
Joined
Feb 13, 2008
Messages
2,422
Office Version
  1. 2010
Hello,

I am trying to add in the formula select "LastRow" but can't get it work

Formula below works perfect look value in the C9

Code:
 Sub FillArrayFormula()
   
      Dim LastRow As Long
      LastRow = Cells(Rows.Count, "DJ").End(xlUp).Row + 1
 
   
      Range("DJ" & LastRow).FormulaArray = "=CHOOSE(MATCH(MATCH([COLOR=#ff0000][B]$C9[/B][/COLOR]&"""",RIGHT($X$7:$Z$7),0),MATCH(SMALL(LEFT($X$3:$Z$3,FIND(""/"",$X$3:$Z$3)-1)*1,{1,2,3}),LEFT($X$3:$Z$3,FIND(""/"",$X$3:$Z$3)-1)*1,0),0),""L"",""M"",""H"")"
      Range("DJ" & LastRow) = Range("DJ" & LastRow).Value
    
End Sub

I want look value in the C & LastRow. i try to modified the formula as shown below but does not result. Is it possible to do it, as I want?

Code:
 Sub FillArrayFormula_1()
   
      Dim LastRow As Long
      LastRow = Cells(Rows.Count, "DJ").End(xlUp).Row + 1
 
   
      Range("DJ" & LastRow).FormulaArray = "=CHOOSE(MATCH(MATCH[COLOR=#000000]([/COLOR][COLOR=#ff0000][B]""C"" & LastRow[/B][/COLOR] &"""",RIGHT($X$7:$Z$7),0),MATCH(SMALL(LEFT($X$3:$Z$3,FIND(""/"",$X$3:$Z$3)-1)*1,{1,2,3}),LEFT($X$3:$Z$3,FIND(""/"",$X$3:$Z$3)-1)*1,0),0),""L"",""M"",""H"")"
      Range("DJ" & LastRow) = Range("DJ" & LastRow).Value
    
End Sub


Please need help if it could be modified or other way possible to use the formula, as I need it.

Thank you all
Excel 2000
Regards,
Moti
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Untested but maybe...

Code:
Range("DJ" & LastRow).FormulaArray = "=CHOOSE(MATCH(MATCH($C" & LastRow & "&"""",RIGHT($X$7:$Z$7),0),MATCH(SMALL(LEFT($X$3:$Z$3,FIND(""/"",$X$3:$Z$3)-1)*1,{1,2,3}),LEFT($X$3:$Z$3,FIND(""/"",$X$3:$Z$3)-1)*1,0),0),""L"",""M"",""H"")"
 
Upvote 0
Untested but maybe...

Code:
Range("DJ" & LastRow).FormulaArray = "=CHOOSE(MATCH(MATCH($C" & LastRow & "&"""",RIGHT($X$7:$Z$7),0),MATCH(SMALL(LEFT($X$3:$Z$3,FIND(""/"",$X$3:$Z$3)-1)*1,{1,2,3}),LEFT($X$3:$Z$3,FIND(""/"",$X$3:$Z$3)-1)*1,0),0),""L"",""M"",""H"")"
MARK858 , Your formula is giving a perfect result as request.

Thank you for your help.

Have a nice day.

Kind Regards,
Moti :)
 
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,197
Members
453,021
Latest member
pingpong7117

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