Format Range Block

billandrew

Well-known Member
Joined
Mar 9, 2014
Messages
743
Afternoon

Trying hopelessly to format the first 3 cells in Column B Bold then the next 4 cells red so on...

Thank You
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
just record yourself doing it and it will create the code, then you can edit the recorded code

i forget but it is something like... Range(...).Font.Bold = True

And Color is called InteriorColor iirc, also in the Font class iirc... just record it
 
Last edited:
Upvote 0
billandrew

The macro recorder is a good way to get started with code.

Of course it's going to spew out a load of dross but it should at least give you something to work with even if it is the syntax to do what you want.

For what it's worth here's what I recorded when bolding the first 3 cells in B and coloring the next 4 red.
Code:
    Range("B1:B3").Select
    Selection.Font.Bold = True
    Range("B4:B7").Select
    With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .Color = 255
        .TintAndShade = 0
        .PatternTintAndShade = 0
    End With
 
Upvote 0
Looks like that would be an absolute range. My data continues for at the moment an undetermined amount of rows.

I should be able to adjust and add a loop of some sort.

Thank you appreciate your time.
 
Upvote 0
Like I said, you'll get a load of dross, in this example Select/Selection etc., but you'll at least get the basic syntax needed.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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