Script for putting a formula in a cell (VBA)

D_Licious

New Member
Joined
May 6, 2015
Messages
11
hi everyone,

so this code, which I've used successfully in the past, is failing me today:

Code:
[LEFT][COLOR=#222222][FONT=arial]Range("L2").Select[/FONT][/COLOR][COLOR=#222222][FONT=arial]        
ActiveCell.FormulaR1C1 = _[/FONT][/COLOR][COLOR=#222222][FONT=arial]        "=VLOOKUP(RC[-9],'[PAID INVOICE Q4-jj.xlsx]Sheet2'!C1:C5,4,<wbr style="display: inline-block;">FALSE)"[/FONT][/COLOR][COLOR=#222222][FONT=arial]    
Range("L2").Select[/FONT][/COLOR][COLOR=#222222][FONT=arial]    
Selection.Copy[/FONT][/COLOR][COLOR=#222222][FONT=arial]    
Range("L3").Select[/FONT][/COLOR][COLOR=#222222][FONT=arial]   Range(Selection, Selection.End(xlDown)).Select[/FONT][/COLOR][COLOR=#222222][FONT=arial]    
Range("L3:L1499").Select[/FONT][/COLOR][COLOR=#222222][FONT=arial]    
ActiveSheet.Paste[/FONT][/COLOR][COLOR=#222222][FONT=arial]    
Application.CutCopyMode = False[/FONT][/COLOR]
[/LEFT]
I simply want to put that formula into L2, but I'm getting an error. If you could respond quickly, it would be very appreciated, as this is for some commission calculations that are due very soon :/

thank you,
 
Last edited by a moderator:

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
is it going to the page you expect ?

The L3 code, use one or other

consider

Range("L2").Select
ActiveCell.FormulaR1C1 = _


to

Range("L2").FormulaR1C1 = _
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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