Willem!
Board Regular
- Joined
- Mar 6, 2009
- Messages
- 139
Hi, When I reference (in code) to a named cell on a different worksheet something goes wrong. When I use the following code, everything works fine:
But when I use the following, I get an error:
So when I replace 'Sheets("Birdie").Ran....' with 'Sheet20.Ran...' the error arises. I want to use the second line of code, because that's more flexible (users can alter the sheetname in that way).
What am I overseeing?
Code:
Sub cmdButton_Click()
Dim dblNumber As Double
dblNumber = Sheets("Birdie").Range("wbet").Value
MsgBox dblNumber
End Sub
But when I use the following, I get an error:
Code:
Sub cmdButton_Click()
Dim dblNumber As Double
dblNumber = Sheet20.Range("wbet").Value
MsgBox dblNumber
End Sub
So when I replace 'Sheets("Birdie").Ran....' with 'Sheet20.Ran...' the error arises. I want to use the second line of code, because that's more flexible (users can alter the sheetname in that way).
What am I overseeing?