SensualCarrots
New Member
- Joined
- Mar 21, 2015
- Messages
- 46
I've been searching the net, but am having a hard time finding an answer. I'd like to understand this before continuing my work.
I read that the difference between Sheets(" and WorkSheets(" is that in older versions of excel, there are different types of sheets, and that for today's standards, we should use WorkSheets("
However, I'm not clear when defining a variable, which of the following I should use when using a standard module to reference a range or object on a sheet.
Which of these is the best to use, and how do they correlate with eacth other? What's the difference between the singular and plural version of Worksheet?
Also, I was trying to call the value of a spin button on a worksheet. It was on Sheet3, labeled "Price Builder". When I use
or
it works perfectly. However, if I try to use any of the combinations of:
...then I get an error message.
Is there an easy explanation for all of this? Or is it more complicated than that?
I read that the difference between Sheets(" and WorkSheets(" is that in older versions of excel, there are different types of sheets, and that for today's standards, we should use WorkSheets("
However, I'm not clear when defining a variable, which of the following I should use when using a standard module to reference a range or object on a sheet.
Code:
Dim ws as Sheet1
Dim ws as Sheets
Dim ws as Worksheet
Dim ws as Worksheets
Set ws = Sheets("Sheet1") 'This is the one I read not to use
Set ws = Worksheet("Sheet1")
Set ws = Worksheets("Sheet1")
Which of these is the best to use, and how do they correlate with eacth other? What's the difference between the singular and plural version of Worksheet?
Also, I was trying to call the value of a spin button on a worksheet. It was on Sheet3, labeled "Price Builder". When I use
Code:
Dim ws as Sheet3
ws.SpinButton1.Value
or
Code:
Sheet3.Spinbutton1.Value
it works perfectly. However, if I try to use any of the combinations of:
Code:
Sheets("Price Builder").SpinButton1.Value
Worksheets("Price Builder").SpinButton1.Value
Worksheet("Price Builder").SpinButton1.Value
Is there an easy explanation for all of this? Or is it more complicated than that?