Clarkie001
IS-IT--Management
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
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"
Comparison_Form.ComboBox2.RowSource = _
ThisWorkbook.Sheets("Hierarchy"
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"
Range("C1"
Range("C4"
End Sub