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: 71
Default Qn: SpinButton1.Max not working??

Hello to ALL Experts,

I have designed a UserForm that should display Doctors in different Counties
where I live. I have 4 different sheets for 4 different counties that
contain all the information. I have a ComboBox1 to select the different
counties. I also have a spin button that cycles through all the doctors. I
have about 10 doctors in County Marion, about 5 doctors in County Hendricks,
and I have about 3 or 4 in the other two. My UserForm1 code is below. What
the problem is, the userform comes up fine, and I have it default to Marion
County. But, it displays 1 of 1 doctors when there is 10 in Marion. Now,
if I click the spin button, then it cycles through to 2 of 10, 3 of 10 and
so on. But, if I click on Hendricks County or any other county, it will
only show the first Doctor and 1 of 1. I cannot display any other Doctors
in any county, including if I return back to Marion. Then it is like the
other counties, just the first record 1 of 1. Can somebody look at my code
below and see what I have done wrong??? Sure would appreciate it. Thanks
in advance... mv


Option Explicit
Dim County As String
Dim HelpTopic As Integer

Private Sub CancelButton_Click()
Unload Me
End Sub

Private Sub UpdateForm()
HelpTopic = SpinButton1.Value
LabelAME.Caption = Sheets(County).Cells(HelpTopic, 1)
LabelDoc.Caption = Sheets(County).Cells(HelpTopic, 2)
LabelClass.Caption = Sheets(County).Cells(HelpTopic, 3)
LabelPL.Caption = Sheets(County).Cells(HelpTopic, 4)
LabelPhone.Caption = Sheets(County).Cells(HelpTopic, 5)
LabelAdd.Caption = Sheets(County).Cells(HelpTopic, 6)
LabelNote.Caption = Sheets(County).Cells(HelpTopic, 7)
Me.Caption = "AME's in " & County & " County (Doctor " & HelpTopic & "
of " & SpinButton1.Max & ")"
End Sub


Private Sub ComboBox1_Change()
If ComboBox1 = "Marion County" Then County = "Marion"
With SpinButton1
.Max =
Application.WorksheetFunction.CountA(Sheets("Mario n").Range("A:A"))
.Min = 1
.Value = 1
End With
UpdateForm

If ComboBox1 = "Hendricks County" Then County = "Hendricks"
With SpinButton1
.Max =
Application.WorksheetFunction.CountA(Sheets("Hendr icks").Range("A:A"))
.Min = 1
.Value = 1
End With
UpdateForm

If ComboBox1 = "Hamilton County" Then County = "Hamilton"
With SpinButton1
.Max =
Application.WorksheetFunction.CountA(Sheets("Hamil ton").Range("A:A"))
.Min = 1
.Value = 1
End With
UpdateForm

If ComboBox1 = "Hancock County" Then County = "Hancock"
With SpinButton1
.Max =
Application.WorksheetFunction.CountA(Sheets("Hanco ck").Range("A:A"))
.Min = 1
.Value = 1
End With
UpdateForm
End Sub

Private Sub SpinButton1_Change()
HelpTopic = SpinButton1.Value
UpdateForm
End Sub

Private Sub UserForm_Initialize()
Me.Caption = APPNAME
ComboBox1 = "Marion County"
With SpinButton1
.Max =
Application.WorksheetFunction.CountA(Sheets("Mario n").Range("A:A"))
.Min = 1
.Value = 1
End With
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
Calculate working days but change working week SamB Excel Discussion (Misc queries) 1 September 1st 08 09:17 PM
Making weekend days working days - the system cuts the working tim Fluffy Excel Discussion (Misc queries) 1 May 30th 08 10:02 PM
macro was working, now it's not working RichardO[_11_] Excel Programming 2 June 9th 04 06:27 AM
Macro working in Excel 2003; not working in Excel 2000 Leslie Barberie Excel Programming 5 May 20th 04 07:51 PM
Adding sales from a non working day to the previous working day Alex Excel Programming 1 September 19th 03 08:48 AM


All times are GMT +1. The time now is 08:56 AM.

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"