Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Arghhh Help....Works on other PC's but not this One.

Status
Not open for further replies.

Clarkie001

IS-IT--Management
Aug 26, 2003
59
GB
Hi,

The following code worked fine on my PC at home, but when I brought it into the work it would not place the values in the "Comparison_Chart" worksheet.

It seems to close the form and not action anything, but when I reopen the form it just keeps going through the loop.

I have no idea why it worked fine before then without any changes started playing up....

Any help would be much appreciated.

Thanks in advance

Clarkie


Option Explicit
Option Compare Text

Sub Comparison_Names()

Dim indexNum As Integer
Dim indexNum2 As Integer
Dim numberInList As Integer
Dim numberInList2 As Integer
Dim chosenValue As String
Dim chosenValue2 As String
Dim I As Integer

Unload Comparison_Form

Comparison_Form.ComboBox1.RowSource = _
ThisWorkbook.Sheets("Hierarchy").Range("Man_Names").Address(external:=True)
Comparison_Form.ComboBox2.RowSource = _
ThisWorkbook.Sheets("Hierarchy").Range("Op_Names").Address(external:=True)

Do

Comparison_Form.Show

If Not bOK Then Exit Sub

If Comparison_Form.ComboBox1.ListIndex > -1 And Comparison_Form.ComboBox2.ListIndex > -1 Then Exit Do

MsgBox "No selection from the list was made"

Comparison_Form.ComboBox1.Value = Null
Comparison_Form.ComboBox2.Value = Null
Loop

indexNum = Comparison_Form.ComboBox1.ListIndex
chosenValue = Comparison_Form.ComboBox1.Value
numberInList = indexNum + 1

indexNum2 = Comparison_Form.ComboBox2.ListIndex
chosenValue2 = Comparison_Form.ComboBox2.Value
numberInList2 = indexNum2 + 1


Unload Comparison_Form

Worksheets("Comparison_Chart").Select
Range("C1").Value = chosenValue2
Range("C4").Value = chosenValue


End Sub

 
Hi!

Is this is an Excel userform question? This is Access VBA forum. I know some of the members here also have high competence in Excel, but if you don't get any help here, you might have better luck posting in forum707

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top