Define Name - VBA

Joined
Mar 18, 2011
Messages
45
Hello everybody,

I'm trying to give a name to a range, but it doesn't work. Could you guys help me? See below how I wrote it:

Range("A1").Select
ult_lin = Cells(Rows.Count, 1).End(xlDown).Row
ult_lin1 = Cells(Rows.Count, 1).End(xlDown).Row
ult_col1 = Cells(ult_lin, Columns.Count).End(xlToRight).Column
Range(Cells(3, 1), Cells(ult_lin1, ult_col1)).Select
ActiveWorkbook.Names.Add Name:="bReuters", RefersToR1C1:="=" & Range("aMarkit") & "!R" & ult_lin & _
"C1:R" & ult_lin1 & "C" & ult_col1 & ""

It shows this error: "Run-time error '1004': Method 'Range"of object '_Global' failed"


Thanks,
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
looking at your cell(rows. blah blah blah

It looks like you're naming everything EXCEPT for your used range.
 
Upvote 0

Forum statistics

Threads
1,224,537
Messages
6,179,408
Members
452,912
Latest member
alicemil

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