ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Syntax Error Help needed (https://www.excelbanter.com/excel-programming/440529-syntax-error-help-needed.html)

Ayo

Syntax Error Help needed
 
How can I fix this code line below. I am getting a "Run-time error '1004':"
"The formula you typed contains an error."
I tried putting quotes at the end and that didn't solve the problem.

ActiveWorkbook.Names.Add Name:="siteList",
RefersToR1C1:="=Error_MarketList!$A$5:$A$" & errorWS_lastRow

ker_01

Syntax Error Help needed
 
untested, but just an observation;
I would expect the reference following RefersToR1C1 ro be in R1C1 notation,
but this appears to be in A1 notation.
Maybe try RefersTo instead of RefersToR1C1?

HTH,
Keith

"Ayo" wrote:

How can I fix this code line below. I am getting a "Run-time error '1004':"
"The formula you typed contains an error."
I tried putting quotes at the end and that didn't solve the problem.

ActiveWorkbook.Names.Add Name:="siteList",
RefersToR1C1:="=Error_MarketList!$A$5:$A$" & errorWS_lastRow


Rich Locus

Syntax Error Help needed
 
Hello:

If all you are trying to do is create a range dynamically, you could use
this simple method:

Public Sub Tester()

Dim errorWS_lastRow As Integer
Dim strRange As String

errorWS_lastRow = 20

strRange = "A5:A" & errorWS_lastRow

Range(strRange).Name = "sitelist"

End Sub

--
Rich Locus
Logicwurks, LLC


"Ayo" wrote:

How can I fix this code line below. I am getting a "Run-time error '1004':"
"The formula you typed contains an error."
I tried putting quotes at the end and that didn't solve the problem.

ActiveWorkbook.Names.Add Name:="siteList",
RefersToR1C1:="=Error_MarketList!$A$5:$A$" & errorWS_lastRow



All times are GMT +1. The time now is 06:49 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com