Eric Penfold
Active Member
- Joined
- Nov 19, 2021
- Messages
- 431
- Office Version
- 365
- Platform
- Windows
- Mobile
How can i change the values in a sentence below to number then next value as percent?
Main code below
VBA Code:
With ws
.Range("A46:Q46").Value = ""
.Range("A46") = "Yesterday we did on " & Rng1.NumberFormat = "2" & " with a GP of " & Rng2.Value = FormatPercent & "."
.Range("A47:Q47").Value = ""
.Range("A47") = "That’s made up of " & Rng3 & " orders with the average value of " & Rng4.NumberFormat = "0" & "."
End With
Main code below
VBA Code:
Option Explicit
Sub YesterdaysDailyMailFigures()
Dim wb As Workbook
Dim ws As Worksheet
Dim dmwb As Workbook
Dim dmws As Worksheet
Dim swb As Workbook
Dim sws As Worksheet
Dim Rng1 As Range, Rng2 As Range, Rng3 As Range, Rng4 As Range
Set wb = Workbooks("MyPersonal.xlsb")
Set ws = wb.Worksheets("DailyMail")
Set swb = ActiveWorkbook
Set sws = swb.Worksheets("Sheet")
With sws
Set Rng1 = .Range("A2")
Set Rng2 = .Range("B2")
Set Rng3 = .Range("C2")
Set Rng4 = .Range("D2")
End With
With ws
.Range("A46:Q46").Value = ""
.Range("A46") = "Yesterday we did on " & Rng1.NumberFormat = "2" & " with a GP of " & Rng2.Value = FormatPercent & "."
.Range("A47:Q47").Value = ""
.Range("A47") = "That’s made up of " & Rng3 & " orders with the average value of " & Rng4.NumberFormat = "0" & "."
End With
End Sub