# Excel VBA - make header row accept formula



## 2Took (Dec 19, 2022)

Hello,

Need to keep whatever the background color and font is, but to remove whatever it is that prevents header row of the spreadsheet to accept a formula.

Even after "Convert to Range" / Do you want to convert the table to a normal range? executed, header row won't take a formula, it will just display the formula itself, instead of its result - like any other cell would.

Need this solved by VBA


----------



## Flashbond (Dec 19, 2022)

I didn't test it. Hope it works
	
	
	
	
	
	



```
Dim rng As Range
Set rng = 'Your cell referance

rng.NumberFormat = "0"
rng.Formula = rng.Value
```


----------



## 2Took (Dec 19, 2022)

Flashbond said:


> I didn't test it. Hope it works
> 
> 
> 
> ...


Gives below error, on:


```
Set rng = activeCell.Value 'Your cell referance
```


----------



## Flashbond (Dec 19, 2022)

Try:

```
Dim rng As Range
Set rng = ActiveCell

rng.NumberFormat = "0"
rng.Formula = rng.Value
```


----------

