Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 989
Default Multiple scrollbars

I have a spreadsheet to manage progress on a project. I am trying to use
multiple scroll bars (one per activity) to give a visual representation of
progress by changing the scrollbar position and colour from red to orange to
green according to progress vs target. Whilst my coding does work it is not
neat as I have to initialise and control each scrollbar indivdually (and
there are 60 + of them). Is there a way to reference them indirectly, some
sort of

For ShtNum = 1 to NumSheets
For i = 1 to sheet(shtNum).scrollbars.count
myscroll=Sheet(ShtNum).scrollbar(i)
If myscroll < 0.9 * target then
myscroll.backcolour = RGB(255,0,0)
Elseif myscroll < 0.95 * target then
myscroll.backcolour = RGB(200,200,0)
Else
myscroll.backcolour = RGB(0,255,0)
Endif
next i
Next ShtNum

I think my issue is that I am not sure which collection the scrollbars fall
into.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Multiple scrollbars

scrollbars from the forms toolbar are part of the scrollbars collection for
each sheet

scrollbars from the control toolbox toolbar are part of the OLEObjects
collection, but so are many other types of object.

Dim obj as OleObject
Dim scr as MSForms.Scrollbar
Dim sh as Worksheet
for each sh in Worksheets
for each obj in sh.OleObjects
if typeof Obj.Object is MSForms.Scrollbar then
set scr = obj.Object
if scr.Value/scr.max .9 then


--
Regards,
Tom Ogilvy


"Mark" wrote:

I have a spreadsheet to manage progress on a project. I am trying to use
multiple scroll bars (one per activity) to give a visual representation of
progress by changing the scrollbar position and colour from red to orange to
green according to progress vs target. Whilst my coding does work it is not
neat as I have to initialise and control each scrollbar indivdually (and
there are 60 + of them). Is there a way to reference them indirectly, some
sort of

For ShtNum = 1 to NumSheets
For i = 1 to sheet(shtNum).scrollbars.count
myscroll=Sheet(ShtNum).scrollbar(i)
If myscroll < 0.9 * target then
myscroll.backcolour = RGB(255,0,0)
Elseif myscroll < 0.95 * target then
myscroll.backcolour = RGB(200,200,0)
Else
myscroll.backcolour = RGB(0,255,0)
Endif
next i
Next ShtNum

I think my issue is that I am not sure which collection the scrollbars fall
into.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 989
Default Multiple scrollbars

Thankyou kindly sir

"Tom Ogilvy" wrote:

scrollbars from the forms toolbar are part of the scrollbars collection for
each sheet

scrollbars from the control toolbox toolbar are part of the OLEObjects
collection, but so are many other types of object.

Dim obj as OleObject
Dim scr as MSForms.Scrollbar
Dim sh as Worksheet
for each sh in Worksheets
for each obj in sh.OleObjects
if typeof Obj.Object is MSForms.Scrollbar then
set scr = obj.Object
if scr.Value/scr.max .9 then


--
Regards,
Tom Ogilvy


"Mark" wrote:

I have a spreadsheet to manage progress on a project. I am trying to use
multiple scroll bars (one per activity) to give a visual representation of
progress by changing the scrollbar position and colour from red to orange to
green according to progress vs target. Whilst my coding does work it is not
neat as I have to initialise and control each scrollbar indivdually (and
there are 60 + of them). Is there a way to reference them indirectly, some
sort of

For ShtNum = 1 to NumSheets
For i = 1 to sheet(shtNum).scrollbars.count
myscroll=Sheet(ShtNum).scrollbar(i)
If myscroll < 0.9 * target then
myscroll.backcolour = RGB(255,0,0)
Elseif myscroll < 0.95 * target then
myscroll.backcolour = RGB(200,200,0)
Else
myscroll.backcolour = RGB(0,255,0)
Endif
next i
Next ShtNum

I think my issue is that I am not sure which collection the scrollbars fall
into.

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
Scrollbars in Listbox Sri Excel Discussion (Misc queries) 2 August 13th 07 01:06 PM
Web Component Scrollbars loudcox Excel Programming 0 November 24th 05 01:23 PM
Scrollbars on a Userform TimT Excel Programming 1 September 14th 05 10:01 PM
Scrollbars & Userforms Keith S Excel Programming 2 January 21st 05 03:05 PM
Getting rid of scrollbars for listbox Marcie Excel Programming 2 September 20th 03 11:15 PM


All times are GMT +1. The time now is 04:57 PM.

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

About Us

"It's about Microsoft Excel"