Results 1 to 5 of 5

merging 2 of the same subs

Threaded View

  1. #1
    Registered User
    Join Date
    12-03-2007
    Location
    NJ
    Posts
    2

    merging 2 of the same subs

    How can I merge these scripts to run on the same worksheet? Each works individually if they are the only script on that worksheet.

    Macro to change col D & G to CAPs
    Private Sub Worksheet_Change(ByVal Target As Range)
    
        Application.EnableEvents = False
        If Not Application.Intersect(Target, Range("D2:D9999")) Is Nothing Then
            Target(1).Value = UCase(Target(1).Value)
        End If
            
        If Not Application.Intersect(Target, Range("G2:G9999")) Is Nothing Then
            Target(1).Value = UCase(Target(1).Value)
        End If
        Application.EnableEvents = True
    
    End Sub
    Macro for TOD entry w/o ":" in col B
    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim vVal
        If Target.Cells.Count > 1 Then Exit Sub
        If Intersect(Target, Range("B2:B9999")) Is Nothing Then Exit Sub
         
         With Target
             
             vVal = Format(.Value, "0000")
              If IsNumeric(vVal) And Len(vVal) = 4 Then
                Application.EnableEvents = False
                .Value = Left(vVal, 2) & ":" & Right(vVal, 2)
                .NumberFormat = "h:mm AM/PM"
              End If
        End With
               
         Application.EnableEvents = True
    
    End Sub
    THANK YOU!
    Last edited by Paugust586; 12-04-2007 at 09:29 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1