Using NumberFormat with Offset

silentwolf

Well-known Member
Joined
May 14, 2008
Messages
1,216
Office Version
  1. 2016
Hi guys,

sorry again for a simple question but I cant seem to get it to work.

Code:
        If Weekday(rngCel) = 1 Then rngCel.Offset(0, 1).Value = 45
            .NumberFormat = "0.00"

Code:
        If Weekday(rngCel) = 1 Then rngCel.Offset(0, 1).Value = Format(45, "Currency")

I have tried with this code above and I am getting the right look of it but it is saved as text in the cell which is not that helpful .(

how do I need to combine this code with numberformating so I am getting € 45,00 for example.

Thank you

Albert
 
Last edited:

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
You can do this:

Code:
If Weekday(rngCel) = 1 Then 
    With rngCel.Offset(0, 1)
        .Value = 45
        .NumberFormat = "€ 0.00"
    End With
 
Upvote 0
I'm not a code expert but by playing around with the macro recorder I came up with this . . .

Code:
If Weekday(rngCel) = 1 Then rngCel.Offset(0, 1).Value = 45.NumberFormat = "[$€-2] #,##0.00"
 
Last edited:
Upvote 0
HI Thanks guys for your help!

Chees it works fine.. I sometimes forget about the makro recorder :)
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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