S
Simon Lloyd
Hi folks!
I have created a userform which works in every way that i want except
problems firstly the combobox works outside of the range i have set i.
no matter which cell i select the combo box pops up and secondly whe
ive made a selection if i was to make another on any other sheet othe
than the first, the activecell will always jump to the previous cel
selected changing the data just entered....any thoughts?
Heres the code!
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim sh As Object
Dim myrange As Range
Dim ComboBox1
Dim I1 As Integer
Dim res As Variant
Dim arySheets
On Error Resume Next
'If sh.Range = ("Hidden") Then
'Exit Sub
'End If
With arySheets
Set myrange = Range("E3:H641")
If Not Intersect(myrange, Target) Is Nothing Then
Sheets("Alpha Packing").Select
ActiveWindow.ScrollWorkbookTabs Position:=xlLast
arySheets = Array("Alpha Packing", "Alpha Process", "Bulk
H&I", _
"Corn Process", "33 Bldg Packing", "Ctd Cor
Packing", _
"2 & 3 Coating", "Crispix", "Feed"
"Flavour", _
"Jet Zones", "Manpower Tasks", "MPD", "Plan
Awareness", _
"Rice Cooking", "Vehicle Drivers (plant)"
"VIP", _
"15-21 & 22", "4&5 Coating", "Tank Floor 15
33 Bldg")
Sheets(arySheets).Select
Sheets("Alpha Packing").Activate
UserForm1.Show
End If
If ActiveCell.Text = "Ref:E-mail" Then
MsgBox "Send E-mail to Training to Have Skill Added!"
'Shell ("cmd /k C:\notes\notes.exe")
'Range("A" & ActiveCell.Row).Select
End If
If Not IsError(res) Then
ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
Sheets("Alpha Packing").Select
Exit Sub
Worksheets("hidden").Visible = False
End If
I1 = MsgBox("Please try again " & vbCrLf & _
"Skill " & " Entry not recognised " & _
"Please Contact Training Dept to Add Skil
Title!!")
If ActiveCell <> "shift " Then
Range("A" & ActiveCell.Row).Select
ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
Sheets("Alpha Packing").Select
End If
End With
End Sub
And heres the combobox code..........
Private Sub ComboBox1_Change()
Dim myrng As Range
On Error Resume Next
'If myrange <> ("E3:H641") Then
'End Sub
'End If
ActiveCell.Select
ActiveCell.Value = ComboBox1.Value
Unload UserForm1
'UserForm1.Hide
Range("A" & ActiveCell.Row).Select
End Sub
hope you can help....
Simo
I have created a userform which works in every way that i want except
problems firstly the combobox works outside of the range i have set i.
no matter which cell i select the combo box pops up and secondly whe
ive made a selection if i was to make another on any other sheet othe
than the first, the activecell will always jump to the previous cel
selected changing the data just entered....any thoughts?
Heres the code!
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim sh As Object
Dim myrange As Range
Dim ComboBox1
Dim I1 As Integer
Dim res As Variant
Dim arySheets
On Error Resume Next
'If sh.Range = ("Hidden") Then
'Exit Sub
'End If
With arySheets
Set myrange = Range("E3:H641")
If Not Intersect(myrange, Target) Is Nothing Then
Sheets("Alpha Packing").Select
ActiveWindow.ScrollWorkbookTabs Position:=xlLast
arySheets = Array("Alpha Packing", "Alpha Process", "Bulk
H&I", _
"Corn Process", "33 Bldg Packing", "Ctd Cor
Packing", _
"2 & 3 Coating", "Crispix", "Feed"
"Flavour", _
"Jet Zones", "Manpower Tasks", "MPD", "Plan
Awareness", _
"Rice Cooking", "Vehicle Drivers (plant)"
"VIP", _
"15-21 & 22", "4&5 Coating", "Tank Floor 15
33 Bldg")
Sheets(arySheets).Select
Sheets("Alpha Packing").Activate
UserForm1.Show
End If
If ActiveCell.Text = "Ref:E-mail" Then
MsgBox "Send E-mail to Training to Have Skill Added!"
'Shell ("cmd /k C:\notes\notes.exe")
'Range("A" & ActiveCell.Row).Select
End If
If Not IsError(res) Then
ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
Sheets("Alpha Packing").Select
Exit Sub
Worksheets("hidden").Visible = False
End If
I1 = MsgBox("Please try again " & vbCrLf & _
"Skill " & " Entry not recognised " & _
"Please Contact Training Dept to Add Skil
Title!!")
If ActiveCell <> "shift " Then
Range("A" & ActiveCell.Row).Select
ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
Sheets("Alpha Packing").Select
End If
End With
End Sub
And heres the combobox code..........
Private Sub ComboBox1_Change()
Dim myrng As Range
On Error Resume Next
'If myrange <> ("E3:H641") Then
'End Sub
'End If
ActiveCell.Select
ActiveCell.Value = ComboBox1.Value
Unload UserForm1
'UserForm1.Hide
Range("A" & ActiveCell.Row).Select
End Sub
hope you can help....
Simo