How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask John D Your Own Question

John D
John D, Bachelor's Degree
Category: Microsoft Office
Satisfied Customers: 9666
Experience:  Bachelor of Science - Engineering Consultant
Type Your Microsoft Office Question Here...
John D is online now
A new question is answered every 9 seconds

I need the code for an excel macro that selects all formulas

This answer was rated:

I need the code for an excel macro that selects all formulas in a worksheet that contain "DBR" and converts the formula into a hard number (ie. convert formula to calculated value)

For formulas containing DBR ie "=DBR(sum(g1:g2))" convert to calculated value. In this case DBR(sum(g1:g2)) = 39



Would you be able to send me the file with the macro so I can set it up for you. To do so go to and upload the file using the Browse button (no need to signup) then copy the "File ID" number (or the download link) that you will be given and paste it here in your reply.


If the file has sensitive information let me know before you upload it


Customer: replied 4 years ago.

the function =DBR requires a connection to our internal database, so you will get errors if you try to calculate the spreadsheet. However, you can test the macro for all formulas using that contain "SUM". I will just edited back to DBR on my end once the macro is done.

Ok here is the stand-alone code for that



Sub ConvertDBR()
Set Rng = ActiveSheet.UsedRange
For Each cell In Rng
If cell.HasFormula = False Then GoTo 111
If InStr(cell.Formula, "DBR") > 0 Then
cell.Value = cell.Value
End If
Next cell
End Sub


Hope this ok. Thank you for rating this answer "Excellent" or "Good" so I get credit for my work. I will continue to assist if you still need help



John D and 2 other Microsoft Office Specialists are ready to help you