Hi all-
Got what I hope is a fairly simple vba question. I am working with a 7 sheet workbook, and each sheet includes (among other things) about 10 input cells. I have used the name manager to define the entire range of those input cells (across all sheets) as "input".
I was hoping to write a simple macro that simply would toggle the background color of these cells between blank and grey, but when I enter into vba, it gives me Run Time Error 1004: Range of Object Global Failed. Here's what I wrote for the macro to change all the cells in the input range to blank.
Sub InputBlank()
'
' InputBlank Macro
' changes input cells to no background
'
Range("input").Select
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
End Sub
I'm wondering if I have to specifically instruct the process to select each worksheet, or if vba simply doesn't work with named ranges across multiple sheets. Any help is appreciated. Thanks!
Got what I hope is a fairly simple vba question. I am working with a 7 sheet workbook, and each sheet includes (among other things) about 10 input cells. I have used the name manager to define the entire range of those input cells (across all sheets) as "input".
I was hoping to write a simple macro that simply would toggle the background color of these cells between blank and grey, but when I enter into vba, it gives me Run Time Error 1004: Range of Object Global Failed. Here's what I wrote for the macro to change all the cells in the input range to blank.
Sub InputBlank()
'
' InputBlank Macro
' changes input cells to no background
'
Range("input").Select
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
End Sub
I'm wondering if I have to specifically instruct the process to select each worksheet, or if vba simply doesn't work with named ranges across multiple sheets. Any help is appreciated. Thanks!