Excel VBA - make header row accept formula

2Took

Board Regular
Joined
Jun 13, 2022
Messages
203
Office Version
  1. 365
Platform
  1. Windows
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
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
I didn't test it. Hope it works
VBA Code:
Dim rng As Range
Set rng = 'Your cell referance

rng.NumberFormat = "0"
rng.Formula = rng.Value
 
Upvote 0
I didn't test it. Hope it works
VBA Code:
Dim rng As Range
Set rng = 'Your cell referance

rng.NumberFormat = "0"
rng.Formula = rng.Value
Gives below error, on:

VBA Code:
Set rng = activeCell.Value 'Your cell referance
2022-12-19_15h10_58.png
 
Upvote 0
Try:
VBA Code:
Dim rng As Range
Set rng = ActiveCell

rng.NumberFormat = "0"
rng.Formula = rng.Value
 
Upvote 0
Solution

Forum statistics

Threads
1,214,985
Messages
6,122,607
Members
449,090
Latest member
vivek chauhan

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