Too many selects!

user21136

Active Member
Joined
Sep 20, 2003
Messages
325
Hi,

Could this be simplified please? It's to change the color of some cells that contain formulas.
Code:
    Range("A1").Select
    Range(Selection, Selection.End(xlToRight)).Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Interior.ColorIndex = 10
    Range("C7").Select
Thanks, Glenn
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Hi
try
Code:
With ActiveSheet.Range("a1")
    ActiveSheet.Range(.End(xlDown), .End(xlToRight)) _
    .Interior.ColorIndex = 10
End With
 
Upvote 0
Hi,

This is sort of related to the above - I have been trying to work out how to do it but totally lost!

In the sheet using the code above I change the color of some cells (A3:C7) that contain formulas.

Next to the formulas in A3:C7 I have a column in with I want to write some notes but would also like to change the color of this column too.

In otherwords, using say column C3:C7 which includes formulas, can I offset this to change the color in D3:D7?

I've tried stuff like this but it doesn't work:
Code:
        Dim v As Range
        Set v = Range("C65536").End(xlUp)
        With v.Offset(1, 1)
            Range(Selection, Selection.End(xlUp)).Select
            Selection.Interior.ColorIndex = 17
        End With
Thanks for any help.

Cheers, Glenn

Edit: the reason why I'm using the End(xlUp) is because the number of formulas vary down the columns in A B and C.
 
Upvote 0

Forum statistics

Threads
1,224,265
Messages
6,177,527
Members
452,782
Latest member
ZCapitao

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