adding formulas with VBA code

Jgordon

New Member
Joined
Apr 4, 2018
Messages
13
Hello ,
I'm trying to add codes to lines in VBA to make my sheet cleaner looking and less likely to be messed with. I'm am very new to this.
I know that my range U4 has " in the formula and is causing an issue. What is the best way to solve it?

Code:
Sub NewDashboardLine()
'
' NewDashboardLine Macro
' Adds a new line to line 4 in Dashboard


'
' Creates new line
    Rows("4:4").Select
    Selection.Insert Shift:=xlDown
    
' Clears contents
    Rows("4:4").Select
    Selection.ClearContents
    Selection.ClearFormats
    
'add formulas to new line
    Range("f3") = "Sale in Progress" 'adds sale status
    Range("M4") = "=HYPERLINK([@[File Address]])"
    Range("U4") = " =IF(AI1="","Not Approved Yet",AI1) "
    Range("Y4") = "=CONCATENATE(UPPER(W1),X1)"
End Sub
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Forum statistics

Threads
1,223,896
Messages
6,175,263
Members
452,627
Latest member
KitkatToby

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