1004 Method Range of Object failed

sheltiedeb

New Member
Joined
Jun 28, 2006
Messages
1
Based on a value on Worksheet "A" (Range of "UserInput"), I need to change the font color on 2 worksheets. I get a runtime error of "Method range of object failed". I have tried adding Sheets("B").Activate before the Sheets("B").Select - that did not help. I am running out of ideas and I am about "googled out". Thanks for any hints/tips that you can throw my way.

Private Sub UserInput_Change()

Application.ScreenUpdating = False

Dim rng_TemplateObjects As Range
Set rng_TemplateObjects = Worksheets("A").Range("UserInput")

Select Case rng_TemplateObjects

Case "BUDGET"
Range("A!A10:A14").Select
Selection.Font.ColorIndex = 3
Sheets("B").Select
Range("B!A6:B6").Select <----- error on this line
Selection.Font.ColorIndex = 3

End Select

End Sub
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Error

Hello,

Get rid of the B! in the range reference.

You are trying to link to the worksheet and you are already there.

Kurt
 
Upvote 0
Have you tried

Code:
 Sheets("B").Range("A6:B6").Font.ColorIndex = 3
 
Upvote 0
Hi Sheltiedeb

Welcome to the board!

Try this:

Code:
Private Sub UserInput_Change()

Application.ScreenUpdating = False

Dim rng_TemplateObjects As Range
Set rng_TemplateObjects = Worksheets("A").Range("UserInput")

Select Case rng_TemplateObjects

Case "BUDGET"
Sheets("A").Range("A10:A14").Font.ColorIndex = 3
Sheets("B").Range("A6:B6").Font.ColorIndex = 3

End Select

End Sub

I must admit, I don't see why you are using a SELECT statement (a simple IF statement should suffice) but it will still work.

Best regards

Richard
 
Upvote 0

Forum statistics

Threads
1,214,915
Messages
6,122,217
Members
449,074
Latest member
cancansova

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