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

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
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,223,911
Messages
6,175,325
Members
452,635
Latest member
laura12345

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