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

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
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,224,823
Messages
6,181,181
Members
453,022
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