Names.Add - compile error

  • Thread starter Thread starter Eric @ BP-EVV
  • Start date Start date
E

Eric @ BP-EVV

Can anyone tell me what's wrong with the following statement that is
preventing my VBA code from compiling ?

Names.Add(Name:="Base",
RefersTo:=ActiveCell.Offset(WorksheetFunction.CountA("$a$2:$a$60000"),6 as
range)

Thank !
 
Can anyone tell me what's wrong with the following statement that is
preventing my VBA code from compiling ?

Names.Add(Name:="Base",
RefersTo:=ActiveCell.Offset(WorksheetFunction.CountA("$a$2:$a$60000"),6 as
range)

Thank !

You shouldn't need the "As Range". This worked for me:

Names.Add "Base", ActiveCell.Offset(WorksheetFunction.CountA("$A$2:$A
$60000"),6)

Alex
 
try this.

Sub makename()
ma = ActiveCell.Address
ActiveWorkbook.Names.Add Name:="base", RefersTo:= _
"=OFFSET(" & ma & ",COUNTA($a$2:$a$6000),6)"
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top