Help formula VBA incorrect calculation when placed in array

Rubygas14

New Member
Joined
Jun 26, 2017
Messages
20
Hi all

The below formula works but i need this to work up to the last row in K when i drag the formula down to autofill the formula works for 1st 10 cells then i receive a #VALUE !

i can put this in to array but it the locks all cells to k3 and give me the incorrect calculation.

this is throught VBA

Code:
 Lastrow = Cells(Rows.Count, "K").End(xlUp).Row
       Range("L3:L" & Lastrow).Select
       Selection.FormulaArray = "=IF(OR(RC[-1]=Hour),TEXT(Post,""dd/mm/yyyy"")&TEXT(Rc[-1],"" ""&""hh:mm""),TEXT(Pre,""dd/mm/yyyy"")&TEXT(Rc[-1],"" ""&""hh:mm""))"
      Lastrow = Cells(Rows.Count, "j").End(xlUp).Row[code]

Any Help will be Great 

Thanks
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Re: Help formula VBA incorrect claculation when placed in array

Try
Code:
LastRow = Cells(Rows.Count, "K").End(xlUp).Row
Range("L3").FormulaArray = "=IF(OR(RC[-1]=Hour),TEXT(Post,""dd/mm/yyyy"")&TEXT(Rc[-1],"" ""&""hh:mm""),TEXT(Pre,""dd/mm/yyyy"")&TEXT(Rc[-1],"" ""&""hh:mm""))"
Range("L3:L" & LastRow).Filldown
LastRow = Cells(Rows.Count, "j").End(xlUp).Row
 
Upvote 0
Re: Help formula VBA incorrect claculation when placed in array

You're welcome
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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