Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Michael,
Not off the top, but I am intrigued. Could you send me your workbook so that I could take a look? What version of Excel? And note my spam filter. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Michael Vaughan" wrote in message ... Hi Bob, I replaced your code with what I had and I came up with a "Run-Time Error '70', Permission Denied". I could not find out for the life of me what caused that... so I put a "On Error Resume Next" in the Private Sub UserForm_Initialize() and then it works perfectly!!!!! Outstanding, that is exactly how I wanted to work. I guess I have to leave the On Error message in, because without it I keep getting the Permission denied??? Any ideas on that??? Thanks for you help in this... Michael Dim County As String Dim HelpTopic As Integer Dim aryMax(1 To 4) As Integer Private Sub CancelButton_Click() Unload Me End Sub Private Sub UpdateForm() With ComboBox1 County = Left(.Value, InStr(.Value, " ") - 1) End With 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() With SpinButton1 .Min = 1 .Max = aryMax(ComboBox1.ListIndex + 1) .Value = 1 End With UpdateForm End Sub Private Sub SpinButton1_Change() HelpTopic = SpinButton1.Value UpdateForm End Sub Private Sub Userform_Activate() With Application.WorksheetFunction aryMax(1) = .CountA(Sheets("Marion").Range("A:A")) aryMax(2) = .CountA(Sheets("Hendricks").Range("A:A")) aryMax(3) = .CountA(Sheets("Hamilton").Range("A:A")) aryMax(4) = .CountA(Sheets("Hancock").Range("A:A")) End With ComboBox1.ListIndex = 0 End Sub Private Sub UserForm_Initialize() Me.Caption = APPNAME With ComboBox1 .AddItem "Marion County" .AddItem "Hendricks County" .AddItem "Hamilton County" .AddItem "Hancock County" End With End Sub -- HTH Bob Phillips |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Calculate working days but change working week | Excel Discussion (Misc queries) | |||
Making weekend days working days - the system cuts the working tim | Excel Discussion (Misc queries) | |||
macro was working, now it's not working | Excel Programming | |||
Macro working in Excel 2003; not working in Excel 2000 | Excel Programming | |||
Adding sales from a non working day to the previous working day | Excel Programming |