# Microsoft Office Application Help - Excel Help forum > Excel Programming / VBA / Macros >  >  VBA Error 2029

## John Eakins

Hi



```
Please Login or Register  to view this content.
```



Data is the sheet name 
The contents of the cell is     #NAME?

Why do I get error 2029 when I try to put the contents of this cell into the Testval variable?


Many thanks

----------


## davesexcel

you need to identify the sheet

Worksheets("Sheet1").Cells(5, 3).Font.Size = 14

----------


## John Eakins

Thanks Dave

Dont think this is the issue

It works fine the way I have it for numeric values and also if the cell value is #name or 
name? 

but I get the error when it is #name?

John

----------


## davesexcel

> Thanks Dave
> 
> Dont think this is the issue
> 
> It works fine the way I have it for numeric values and also if the cell value is #name or 
> name? 
> 
> but I get the error when it is #name?
> 
> John



Hi, what is the code supposed to do?

here's some info on error 2029, it may or may not help

http://support.microsoft.com/kb/823604
http://www.mrexcel.com/archive2/13000/14528.htm

----------


## mikerickson

When the cell displays #NAME? it is returning an error value. Your code is reading that error value and it is passing through. If you dimension Testval as variant there won't be an error. As is, you do have a problem with numbers. Since Testval is a string, when 1 is in A1, Testval is the string "1" not the number 1. Dim Testval as variant will fix that.

Unless you want TestVal to be a string, in which case.




```
Please Login or Register  to view this content.
```


would be the fix. It also works for the error situation, Testval won't be the error value in A1, but the string "#NAME?"

----------

