VBA Code to fill out column with formula's

mrsushi

Board Regular
Joined
Nov 18, 2006
Messages
180
Office Version
  1. 2010
Good evening,

I have Column A with over 30,000 cells of data.

Column D+E+F+G have formulas run via a VBA script (This is as per below). The problem with applying the below via a script, is it takes forever to complete.

Is there an alternative VBA code to which can be used?

Many thanks




lngLastRow = Range("A" & Rows.Count).End(xlUp).Row
Range("D5:D" & lngLastRow).FormulaR1C1 = "=IF(COUNTIF(R5C1:R50000C1,RC1)>1,""Duplicate"","""")"

lngLastRow = Range("A" & Rows.Count).End(xlUp).Row
Range("E5:E" & lngLastRow).FormulaR1C1 = "=VLOOKUP(CONCATENATE(RC[-4],"" "", RC[-3]),'LT03 Full Data'!C[-4]:C[-2], 2, FALSE)"

lngLastRow = Range("A" & Rows.Count).End(xlUp).Row
Range("F5:F" & lngLastRow).FormulaR1C1 = "=VLOOKUP(CONCATENATE(RC[-5],RC[-4]),'LT03 Full Data'!C[-5]:C[-3], 2, FALSE)"

lngLastRow = Range("A" & Rows.Count).End(xlUp).Row
Range("G5:G" & lngLastRow).FormulaR1C1 = "=IF(ISTEXT(RC[-2]),RC[-2],IF(ISTEXT(RC[-1]),RC[-1]))"
 
Try limiting the vlookup formula the way Jasonb75 showed & remove the countif formula. See how long that takes.
 
Upvote 0

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

Forum statistics

Threads
1,214,583
Messages
6,120,383
Members
448,956
Latest member
JPav

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