LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 68
Default Help with Sub's on a worksheet

I've gotten a lot of help with this problem, but I still can't get it to
work. I have the following code on sheet 1, and I know that it doesn't work,
but I'm not sure how to fix it. I realize that I can't have two
Worksheet_Change subs on the same sheet, and both work if they stand alone.
Any help would be appreciated. Thanks

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("K18:K37")) Is Nothing Then Exit Sub
Application.EnableEvents = False
On Error Resume Next

' Check to see if a past action is occuring
If Application.CutCopyMode = xlCopy Or _
Application.CutCopyMode = xlCut Then

Application.Undo
Selection.PasteSpecial Paste:=xlPasteValues
End If

Application.EnableEvents = True

End Sub
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬ ¬¬¬¬-__________________________________________________ __________________________________________

Private Sub Worksheet_Change(ByVal Target As Excel.Range)

Dim TimeStr As String

If Target.Address = "$J$2" Then Call selectthecase

On Error GoTo EndMacro
If Application.Intersect(Target,
Range("L6:M61,E48:F61,D73:D83,D87:D105,L87:L93,M73 :M83,D6:D24,D28:D43,B109:B127")) Is Nothing Then
Exit Sub
End If
If Target.Cells.Count 1 Then
Exit Sub
End If
If Target.Value = "" Then
Exit Sub
End If

Application.EnableEvents = False
With Target
If .HasFormula = False Then
€˜ A number of Select Case stuff goes in here
End Select
.Value = TimeValue(TimeStr)
End If
End With
Application.EnableEvents = True
Exit Sub
EndMacro:
MsgBox "You did not enter a valid time"
Application.EnableEvents = True
End Sub

--
Howard
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
automatically appending newly added data on worksheet to a master list worksheet tabylee via OfficeKB.com Links and Linking in Excel 0 December 17th 09 04:24 PM
Passing a Sub's name as parameter Stefi Excel Programming 7 June 20th 05 08:48 PM
using Sub's with checkboxs dave bryden Excel Programming 4 February 26th 04 10:24 PM
VB how to connect two sub's Christof[_5_] Excel Programming 2 November 11th 03 07:13 AM


All times are GMT +1. The time now is 05:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"