ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Not resetting all cells (https://www.excelbanter.com/excel-programming/402880-not-resetting-all-cells.html)

Chuck

Not resetting all cells
 
The following code works for the first ActiveSheet.ScrollBar1.Value command
works, but the ActiveSheet.ScrollBar2-9 commands do not. The last 4 commands
(ActiveSheet.Range("D10) through "D16" also work. Appreciate any help.
Thanks.

ActiveSheet.ScrollBar1.Value = ActiveSheet.Range("U31")
ActiveSheet.ScrollBar2.Value = ActiveSheet.Range("U32")
ActiveSheet.ScrollBar3.Value = ActiveSheet.Range("U33")
ActiveSheet.ScrollBar4.Value = ActiveSheet.Range("U34")
ActiveSheet.ScrollBar5.Value = ActiveSheet.Range("U35")
ActiveSheet.ScrollBar6.Value = ActiveSheet.Range("U36")
ActiveSheet.ScrollBar7.Value = ActiveSheet.Range("U37")
ActiveSheet.ScrollBar8.Value = ActiveSheet.Range("U38")
ActiveSheet.ScrollBar9.Value = ActiveSheet.Range("U39")

ActiveSheet.Range("D10") = Range("C10")
ActiveSheet.Range("D12") = Range("C12")
ActiveSheet.Range("D14") = Range("C14")
ActiveSheet.Range("D16") = Range("C16")

JLGWhiz

Not resetting all cells
 
Be sure your cells are formatted as numbers and not text. Your code looks OK.

"Chuck" wrote:

The following code works for the first ActiveSheet.ScrollBar1.Value command
works, but the ActiveSheet.ScrollBar2-9 commands do not. The last 4 commands
(ActiveSheet.Range("D10) through "D16" also work. Appreciate any help.
Thanks.

ActiveSheet.ScrollBar1.Value = ActiveSheet.Range("U31")
ActiveSheet.ScrollBar2.Value = ActiveSheet.Range("U32")
ActiveSheet.ScrollBar3.Value = ActiveSheet.Range("U33")
ActiveSheet.ScrollBar4.Value = ActiveSheet.Range("U34")
ActiveSheet.ScrollBar5.Value = ActiveSheet.Range("U35")
ActiveSheet.ScrollBar6.Value = ActiveSheet.Range("U36")
ActiveSheet.ScrollBar7.Value = ActiveSheet.Range("U37")
ActiveSheet.ScrollBar8.Value = ActiveSheet.Range("U38")
ActiveSheet.ScrollBar9.Value = ActiveSheet.Range("U39")

ActiveSheet.Range("D10") = Range("C10")
ActiveSheet.Range("D12") = Range("C12")
ActiveSheet.Range("D14") = Range("C14")
ActiveSheet.Range("D16") = Range("C16")


Chuck

Not resetting all cells
 
Thanks for responding. However, the scrollbars and the linked cells are all
formatted the same (as numbers).

"JLGWhiz" wrote:

Be sure your cells are formatted as numbers and not text. Your code looks OK.

"Chuck" wrote:

The following code works for the first ActiveSheet.ScrollBar1.Value command
works, but the ActiveSheet.ScrollBar2-9 commands do not. The last 4 commands
(ActiveSheet.Range("D10) through "D16" also work. Appreciate any help.
Thanks.

ActiveSheet.ScrollBar1.Value = ActiveSheet.Range("U31")
ActiveSheet.ScrollBar2.Value = ActiveSheet.Range("U32")
ActiveSheet.ScrollBar3.Value = ActiveSheet.Range("U33")
ActiveSheet.ScrollBar4.Value = ActiveSheet.Range("U34")
ActiveSheet.ScrollBar5.Value = ActiveSheet.Range("U35")
ActiveSheet.ScrollBar6.Value = ActiveSheet.Range("U36")
ActiveSheet.ScrollBar7.Value = ActiveSheet.Range("U37")
ActiveSheet.ScrollBar8.Value = ActiveSheet.Range("U38")
ActiveSheet.ScrollBar9.Value = ActiveSheet.Range("U39")

ActiveSheet.Range("D10") = Range("C10")
ActiveSheet.Range("D12") = Range("C12")
ActiveSheet.Range("D14") = Range("C14")
ActiveSheet.Range("D16") = Range("C16")


Gord Dibben

Not resetting all cells
 
Formatting means nothing.

If the cells' values are actually text, re-formatting to General or Number will
not change that fact.

You must coerce them from text to numeric.


Gord Dibben MS Excel MVP

On Mon, 17 Dec 2007 12:14:23 -0800, Chuck
wrote:

Thanks for responding. However, the scrollbars and the linked cells are all
formatted the same (as numbers).

"JLGWhiz" wrote:

Be sure your cells are formatted as numbers and not text. Your code looks OK.

"Chuck" wrote:

The following code works for the first ActiveSheet.ScrollBar1.Value command
works, but the ActiveSheet.ScrollBar2-9 commands do not. The last 4 commands
(ActiveSheet.Range("D10) through "D16" also work. Appreciate any help.
Thanks.

ActiveSheet.ScrollBar1.Value = ActiveSheet.Range("U31")
ActiveSheet.ScrollBar2.Value = ActiveSheet.Range("U32")
ActiveSheet.ScrollBar3.Value = ActiveSheet.Range("U33")
ActiveSheet.ScrollBar4.Value = ActiveSheet.Range("U34")
ActiveSheet.ScrollBar5.Value = ActiveSheet.Range("U35")
ActiveSheet.ScrollBar6.Value = ActiveSheet.Range("U36")
ActiveSheet.ScrollBar7.Value = ActiveSheet.Range("U37")
ActiveSheet.ScrollBar8.Value = ActiveSheet.Range("U38")
ActiveSheet.ScrollBar9.Value = ActiveSheet.Range("U39")

ActiveSheet.Range("D10") = Range("C10")
ActiveSheet.Range("D12") = Range("C12")
ActiveSheet.Range("D14") = Range("C14")
ActiveSheet.Range("D16") = Range("C16")



JLGWhiz

Not resetting all cells
 
What are you expecting to happen with the command? That is, do you expect
the scrollbox for those eight scrollbars to be in a position between the max
and min that would result in a scroll by equating to the values in cells
U32-U39? When you say it is not working, it helps to define what you are
expecting it to do.

"Chuck" wrote:

Thanks for responding. However, the scrollbars and the linked cells are all
formatted the same (as numbers).

"JLGWhiz" wrote:

Be sure your cells are formatted as numbers and not text. Your code looks OK.

"Chuck" wrote:

The following code works for the first ActiveSheet.ScrollBar1.Value command
works, but the ActiveSheet.ScrollBar2-9 commands do not. The last 4 commands
(ActiveSheet.Range("D10) through "D16" also work. Appreciate any help.
Thanks.

ActiveSheet.ScrollBar1.Value = ActiveSheet.Range("U31")
ActiveSheet.ScrollBar2.Value = ActiveSheet.Range("U32")
ActiveSheet.ScrollBar3.Value = ActiveSheet.Range("U33")
ActiveSheet.ScrollBar4.Value = ActiveSheet.Range("U34")
ActiveSheet.ScrollBar5.Value = ActiveSheet.Range("U35")
ActiveSheet.ScrollBar6.Value = ActiveSheet.Range("U36")
ActiveSheet.ScrollBar7.Value = ActiveSheet.Range("U37")
ActiveSheet.ScrollBar8.Value = ActiveSheet.Range("U38")
ActiveSheet.ScrollBar9.Value = ActiveSheet.Range("U39")

ActiveSheet.Range("D10") = Range("C10")
ActiveSheet.Range("D12") = Range("C12")
ActiveSheet.Range("D14") = Range("C14")
ActiveSheet.Range("D16") = Range("C16")


Chuck

Not resetting all cells
 
What I would like to happen is that when the Command Button is clicked, the
scrollbar returns to the value in cell U31, for example. Let's say that cell
U31 has a value of 5,000 and the current value of the scrollbar is 4,500.
When the Command Button is clicked the scrollbar should move to 5,000. This
only happens with the first line of code (referring to cell U31), but not the
lines of code referring to U32-U39.

"JLGWhiz" wrote:

What are you expecting to happen with the command? That is, do you expect
the scrollbox for those eight scrollbars to be in a position between the max
and min that would result in a scroll by equating to the values in cells
U32-U39? When you say it is not working, it helps to define what you are
expecting it to do.

"Chuck" wrote:

Thanks for responding. However, the scrollbars and the linked cells are all
formatted the same (as numbers).

"JLGWhiz" wrote:

Be sure your cells are formatted as numbers and not text. Your code looks OK.

"Chuck" wrote:

The following code works for the first ActiveSheet.ScrollBar1.Value command
works, but the ActiveSheet.ScrollBar2-9 commands do not. The last 4 commands
(ActiveSheet.Range("D10) through "D16" also work. Appreciate any help.
Thanks.

ActiveSheet.ScrollBar1.Value = ActiveSheet.Range("U31")
ActiveSheet.ScrollBar2.Value = ActiveSheet.Range("U32")
ActiveSheet.ScrollBar3.Value = ActiveSheet.Range("U33")
ActiveSheet.ScrollBar4.Value = ActiveSheet.Range("U34")
ActiveSheet.ScrollBar5.Value = ActiveSheet.Range("U35")
ActiveSheet.ScrollBar6.Value = ActiveSheet.Range("U36")
ActiveSheet.ScrollBar7.Value = ActiveSheet.Range("U37")
ActiveSheet.ScrollBar8.Value = ActiveSheet.Range("U38")
ActiveSheet.ScrollBar9.Value = ActiveSheet.Range("U39")

ActiveSheet.Range("D10") = Range("C10")
ActiveSheet.Range("D12") = Range("C12")
ActiveSheet.Range("D14") = Range("C14")
ActiveSheet.Range("D16") = Range("C16")


JLGWhiz

Not resetting all cells
 
Then like Gord wrote, you need to make sure that the value you see in your
reference cells is, in fact, numerical. You can run an easy check with a
message box: MsgBox ActiveSheet.Range("U32")

If you see "5000" in the message box, you identify the problem as text.
If you see 5000 in the message box, and it still does not set to the correct
position, then you have another type problem elsewhere.

You can concatenate the ranges and check them all at once.

Good Luck
"Chuck" wrote:

What I would like to happen is that when the Command Button is clicked, the
scrollbar returns to the value in cell U31, for example. Let's say that cell
U31 has a value of 5,000 and the current value of the scrollbar is 4,500.
When the Command Button is clicked the scrollbar should move to 5,000. This
only happens with the first line of code (referring to cell U31), but not the
lines of code referring to U32-U39.

"JLGWhiz" wrote:

What are you expecting to happen with the command? That is, do you expect
the scrollbox for those eight scrollbars to be in a position between the max
and min that would result in a scroll by equating to the values in cells
U32-U39? When you say it is not working, it helps to define what you are
expecting it to do.

"Chuck" wrote:

Thanks for responding. However, the scrollbars and the linked cells are all
formatted the same (as numbers).

"JLGWhiz" wrote:

Be sure your cells are formatted as numbers and not text. Your code looks OK.

"Chuck" wrote:

The following code works for the first ActiveSheet.ScrollBar1.Value command
works, but the ActiveSheet.ScrollBar2-9 commands do not. The last 4 commands
(ActiveSheet.Range("D10) through "D16" also work. Appreciate any help.
Thanks.

ActiveSheet.ScrollBar1.Value = ActiveSheet.Range("U31")
ActiveSheet.ScrollBar2.Value = ActiveSheet.Range("U32")
ActiveSheet.ScrollBar3.Value = ActiveSheet.Range("U33")
ActiveSheet.ScrollBar4.Value = ActiveSheet.Range("U34")
ActiveSheet.ScrollBar5.Value = ActiveSheet.Range("U35")
ActiveSheet.ScrollBar6.Value = ActiveSheet.Range("U36")
ActiveSheet.ScrollBar7.Value = ActiveSheet.Range("U37")
ActiveSheet.ScrollBar8.Value = ActiveSheet.Range("U38")
ActiveSheet.ScrollBar9.Value = ActiveSheet.Range("U39")

ActiveSheet.Range("D10") = Range("C10")
ActiveSheet.Range("D12") = Range("C12")
ActiveSheet.Range("D14") = Range("C14")
ActiveSheet.Range("D16") = Range("C16")


Chuck

Not resetting all cells
 
OK. Thanks for all of your help.

"JLGWhiz" wrote:

Then like Gord wrote, you need to make sure that the value you see in your
reference cells is, in fact, numerical. You can run an easy check with a
message box: MsgBox ActiveSheet.Range("U32")

If you see "5000" in the message box, you identify the problem as text.
If you see 5000 in the message box, and it still does not set to the correct
position, then you have another type problem elsewhere.

You can concatenate the ranges and check them all at once.

Good Luck
"Chuck" wrote:

What I would like to happen is that when the Command Button is clicked, the
scrollbar returns to the value in cell U31, for example. Let's say that cell
U31 has a value of 5,000 and the current value of the scrollbar is 4,500.
When the Command Button is clicked the scrollbar should move to 5,000. This
only happens with the first line of code (referring to cell U31), but not the
lines of code referring to U32-U39.

"JLGWhiz" wrote:

What are you expecting to happen with the command? That is, do you expect
the scrollbox for those eight scrollbars to be in a position between the max
and min that would result in a scroll by equating to the values in cells
U32-U39? When you say it is not working, it helps to define what you are
expecting it to do.

"Chuck" wrote:

Thanks for responding. However, the scrollbars and the linked cells are all
formatted the same (as numbers).

"JLGWhiz" wrote:

Be sure your cells are formatted as numbers and not text. Your code looks OK.

"Chuck" wrote:

The following code works for the first ActiveSheet.ScrollBar1.Value command
works, but the ActiveSheet.ScrollBar2-9 commands do not. The last 4 commands
(ActiveSheet.Range("D10) through "D16" also work. Appreciate any help.
Thanks.

ActiveSheet.ScrollBar1.Value = ActiveSheet.Range("U31")
ActiveSheet.ScrollBar2.Value = ActiveSheet.Range("U32")
ActiveSheet.ScrollBar3.Value = ActiveSheet.Range("U33")
ActiveSheet.ScrollBar4.Value = ActiveSheet.Range("U34")
ActiveSheet.ScrollBar5.Value = ActiveSheet.Range("U35")
ActiveSheet.ScrollBar6.Value = ActiveSheet.Range("U36")
ActiveSheet.ScrollBar7.Value = ActiveSheet.Range("U37")
ActiveSheet.ScrollBar8.Value = ActiveSheet.Range("U38")
ActiveSheet.ScrollBar9.Value = ActiveSheet.Range("U39")

ActiveSheet.Range("D10") = Range("C10")
ActiveSheet.Range("D12") = Range("C12")
ActiveSheet.Range("D14") = Range("C14")
ActiveSheet.Range("D16") = Range("C16")



All times are GMT +1. The time now is 04:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com