Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default ScrollBar Sheet problem

Hi,


Following procedures
-------------------------------------------------------------
Private Sub ScrollBar1_Change()

Range("A1").Value = ScrollBar1.Value

End Sub
-------------------------------------------------------------
Private Sub ScrollBar1_Scroll()

Range("A1").Value = ScrollBar1.Value

End Sub
-------------------------------------------------------------
for ScrollBar1 (with parameters Min=0, Max=10) on sheet change values
in cell A1 from 0 to 10 using step 1. How to write procedures that
change in cell A1 value from 1,00 to 10,00 using step 0,01, but without
indirect cell (like in example in John Walkenbach's book)? And second
problem. When I set in cell A1 new value and click scrollbar arrow,
value in cell changes from last 'remembered' by scrollbar value not
from new value. How to resolve such problem?

Best wishes

Dan

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default ScrollBar Sheet problem

change the max to 900 and keep the min at zero, then use

Private Sub ScrollBar1_Change()
Range("A1").Value = ScrollBar1.Value / 100 + 1
End Sub

Don't use any other events.

--
Regards,
Tom Ogilvy



" wrote:

Hi,


Following procedures
-------------------------------------------------------------
Private Sub ScrollBar1_Change()

Range("A1").Value = ScrollBar1.Value

End Sub
-------------------------------------------------------------
Private Sub ScrollBar1_Scroll()

Range("A1").Value = ScrollBar1.Value

End Sub
-------------------------------------------------------------
for ScrollBar1 (with parameters Min=0, Max=10) on sheet change values
in cell A1 from 0 to 10 using step 1. How to write procedures that
change in cell A1 value from 1,00 to 10,00 using step 0,01, but without
indirect cell (like in example in John Walkenbach's book)? And second
problem. When I set in cell A1 new value and click scrollbar arrow,
value in cell changes from last 'remembered' by scrollbar value not
from new value. How to resolve such problem?

Best wishes

Dan


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default ScrollBar Sheet problem

Tom,

Great thanks. There is still problem when I set value to the cell and
push arrow, scrollbar start from old remebered one.

Regards
Dan

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default ScrollBar Sheet problem

'this line must be at the top of the module
Public bBlockEvents As Boolean

Private Sub ScrollBar1_Change()
If bBlockEvents Then Exit Sub
On Error GoTo ErrHandler
Application.EnableEvents = False
Range("A1").Value = ScrollBar1.Value / 100 + 1
ErrHandler:
Application.EnableEvents = True
End Sub

Private Sub Worksheet_Change(ByVal target As Range)
On Error GoTo ErrHandler
If target.Address = "$A$1" Then
Select Case target.Value
Case 1 To 10
bBlockEvents = True
ScrollBar1.Value = (Range("A1").Value - 1) * 100
Case Else
Application.EnableEvents = False
target.Value = ScrollBar1.Value / 100 + 1
End Select
End If
ErrHandler:
bBlockEvents = False
Application.EnableEvents = True
End Sub


If some events stop working it is probably because application.EnableEvents
has remained set to false or bBlockEvents has been set to True. If you can't
fix them any other way, close and reopen Excel. I wouldn't expect this to
happen unless you are altering/editing and testing code.

--
Regards,
Tom Ogilvy


" wrote:

Tom,

Great thanks. There is still problem when I set value to the cell and
push arrow, scrollbar start from old remebered one.

Regards
Dan


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default ScrollBar Sheet problem

Tom,

thanks for help. How you certainly observed, I'm beginner in Excel
object model, so some of my quastions are rather trivial.

Regards

Dan



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sheet tabs & horizontal scrollbar disappeared - Excel 2003 RHK Excel Discussion (Misc queries) 3 November 29th 07 11:08 PM
inserting scrollbar inside an Excel Sheet Genesis[_2_] Excel Discussion (Misc queries) 3 October 23rd 07 05:35 AM
scrollbar reslut makes another scrollbar to show Patrik Excel Discussion (Misc queries) 0 April 18th 05 03:11 PM
Unlock a spinner or scrollbar on a protected sheet kevin99 Excel Worksheet Functions 1 March 14th 05 01:03 PM
Excel VBA - Userform Texbox/Scrollbar problem thesteelmaker[_5_] Excel Programming 2 March 6th 04 09:09 PM


All times are GMT +1. The time now is 12:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"