View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Simon Lloyd[_417_] Simon Lloyd[_417_] is offline
external usenet poster
 
Posts: 1
Default Help needed, Input box doing 2 tasks?

Bob,

I dont think i can merge the code as 1 is a workbook event and works o
the same range on each sheet but the worksheet event works on differen
ranges on each sheet, here is the work book code it's out of the tes
book and not the working program but you will get the gist!

Option Explicit
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVa
Target As Range)
Dim myrange As Range
Dim isect As Range
If Sh.Name = "Hidden" Then Exit Sub
Set myrange = Sh.Range("E1:G20")


Set isect = Application.Intersect(myrange, Target)
If isect Is Nothing Then

Exit Sub
End If
Sheets("Sheet1").Select
ActiveWindow.ScrollWorkbookTabs Position:=xlLast
Sheets(Array("Sheet1", "Sheet2", "Sheet4", "Sheet3")).Select
Sheets("Sheet1").Activate
Dim t1 As String
Dim I1 As Integer
Dim res As Variant

t1 = InputBox("Only Valid Skill Titles Will Be Allowed!", "Skil
Addition Box", "")
With Worksheets("Hidden")
res = Application.Match(t1, .Range(.Range("A2"), _
.Range("A2").End(xlDown)), 0)
End With
If Not IsError(res) Then
ActiveCell = t1
Range("A" & ActiveCell.Row).Select
Sheets(Array("Sheet1", "Sheet2", "Sheet4", "Sheet3")).Select
Sheets("Sheet1").Activate
Sheets("Sheet1").Name = "Sheet1"
Sheets("Sheet1").Select

Exit Sub



Worksheets("hidden").Visible = False
End If

I1 = MsgBox("Please try again " & Chr(13) & "Skill " & " Entry no
recognised " & "Please Contact Training Dept to Add Skill Title!!")
If ActiveCell = "shift " Then
Exit Sub
Else
Range("A" & ActiveCell.Row).Select
Sheets(Array("Sheet1", "Sheet2", "Sheet4", "Sheet3")).Select
Sheets("Sheet1").Activate
Sheets("Sheet1").Name = "Sheet1"
Sheets("Sheet1").Select

End If
End Sub

if you would like to have all the code i have for all macro's in th
working program i can either paste them into an e-mail or if you want
can attatch the whole program its 5.5 meg and when it updates o
shutdown (thats the way i have designed it)it takes about 5 mins to d
20 sheets!

E-mail me and let me know.

p.s are you a professional programmer or just have a great intrest i
VB?

Simon

--
Message posted from http://www.ExcelForum.com