I have the following VBA to insert a value into each sheet using the NEXT
function:
Sub Insert_Values()
Dim b As Worksheet
For Each b In Worksheets
Dim Range As Range
Set Range = b.Range("B2:C4")
b.Select
Range.Value = 1
Next b
End Sub
All this works fine so far.
However, now I want to use a named range
instead of Set Range = b.Range("B2:C4")
.
Therefore, I assigned Range_01
in the name manager
to the Range("B2:C4")
looking like this:
In the VBA I changed:
Dim Range As Range
Set Range = b.Range("Range_01")
Now, I get runtime error 1004
.
I assume the reason is that in the name manager
the Sheet1
is fixed assigned to the Range_01
.
Therefore, I am wondering if there is way to assign a named range
but without a fixed Sheet
so the NEXT
function can still run through all sheets?