Wrong in refering to workbook

kin

Well-known Member
Joined
Jun 26, 2007
Messages
648
Hello

Sub Macro4()


Columns("A:A").Select
Range("A16").Activate
Application.CutCopyMode = False
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Range("A1").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[6],'THEMATERIALSBROKEN'Sheet1!R1C1:R250C2,2,FALSE)"
Range("A1").Select
Selection.AutoFill Destination:=Range("A1:E300"), Type:=xlFillDefault
Range("A1:E300").Select
Selection.AutoFill Destination:=Range("A1:E300"), Type:=xlFillDefault
Range("A1:E300").Select
Selection.NumberFormat = "0"
End Sub


I dont know how to refer to "=VLOOKUP(RC[6],'THEMATERIALSBROKEN'Sheet1

THEMATERIALSBROKEN is another workbook with the vlookup table
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
I've tested my code and it returns the correct formulas so I'm not sure what is wrong.
 
Upvote 0
Check that the macro is entering the correct formulas. I only ran a quick test.
 
Upvote 0
WELL i found it

I used to open the file from outlook while the broken materials were in another directory

its allright now

thanks
 
Upvote 0

Forum statistics

Threads
1,214,989
Messages
6,122,622
Members
449,093
Latest member
catterz66

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