LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Multiple combobox and change events

Hi All, please bare with me, I've been using VBA for a little over a
week now.

I have a form with two combobox's. The first pulls some data from the
worksheet and fills in some textbox's after running a simple equation
on them. The second combobox updates those same textbox's with the
same equation, but uses listindex from the first combobox in that
equation. Both do there work in _Change events subroutines.

At runtime I get an error because listindex isn't being passed to the
second combobox _Change event Sub. I get Run-time error: '1004':
Method 'Range' of object '_Global' failed. If I change the event to
AfterUpdate it works fine, but you have to click on the first combobox
to get the fields to update.

Am I doing something stupid?


Private Sub BinParameter_Change()
Dim ColumnReference As String
ColumnReference = "" & ColNo2ColRef(BinParameter.ListIndex + 1) &
":" _
& ColNo2ColRef(BinParameter.ListIndex + 1) &
""

Dim BinIncrement As Single
BinIncrement =
(Application.WorksheetFunction.Max(Range(ColumnRef erence)) - _

Application.WorksheetFunction.Min(Range(ColumnRefe rence))) /
(NumberOfBins.ListIndex + 1)

Bin1.Text =
Truncate(Application.WorksheetFunction.Min(Range(C olumnReference)) +
BinIncrement * 1, 8)
Bin2.Text =
Truncate(Application.WorksheetFunction.Min(Range(C olumnReference)) +
BinIncrement * 2, 8)
Bin3.Text =
Truncate(Application.WorksheetFunction.Min(Range(C olumnReference)) +
BinIncrement * 3, 8)
End Sub


Private Sub NumberOfBins_Change()
Dim ColumnReference As String
ColumnReference = "" & ColNo2ColRef(BinParameter.ListIndex + 1) &
":" _
& ColNo2ColRef(BinParameter.ListIndex + 1) &
""

Dim BinIncrement As Single
BinIncrement =
(Application.WorksheetFunction.Max(Range(ColumnRef erence)) - _

Application.WorksheetFunction.Min(Range(ColumnRefe rence))) /
(NumberOfBins.ListIndex + 1)

Bin1.Text =
Truncate(Application.WorksheetFunction.Min(Range(C olumnReference)) +
BinIncrement * 1, 8)
Bin2.Text =
Truncate(Application.WorksheetFunction.Min(Range(C olumnReference)) +
BinIncrement * 2, 8)
Bin3.Text =
Truncate(Application.WorksheetFunction.Min(Range(C olumnReference)) +
BinIncrement * 3, 8)

End Sub

 
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
ComboBox Events Fire Many Times ms Excel Programming 4 May 4th 06 01:25 PM
combobox change event is running when enable events is false tysop Excel Programming 3 January 24th 06 02:16 PM
Multiple change events on same sheet JG Scott Excel Programming 4 January 19th 06 03:56 AM
Multiple change events on same sheet JG Scott Excel Programming 0 November 30th 05 01:45 PM
combobox events Jane Excel Programming 5 December 15th 04 01:56 PM


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

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"