Results 1 to 10 of 18

Thread: Inserting time in spreadsheet

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #18
    Member rollis13's Avatar
    Join Date
    Nov 2012
    Posts
    36
    Rep Power
    0
    You need to right click the TabName of the sheet to open it's VBA panel then copy the macro in the right blank space.
    Have a try with this after changing the sheet's name in the macro (now it is Sheet1):
    Code:
    Option Explicit
    Private Sub Worksheet_Change(ByVal Target As Range)
        Dim r As Long
        Dim c As Long
        Dim Cell As Range
        
        With Application
            .Calculation = xlCalculationManual
            .ScreenUpdating = False
            .DisplayAlerts = False
        End With
        
        If ActiveSheet.Name = "Sheet1" Then        'change name of sheet as needed
             'Resume to next line if any error occurs
            On Error Resume Next
            With ActiveSheet
                .Unprotect                          'unprotect entire sheet
                 'search for non blank cells and lock them and unlock blank cells
                For Each Cell In ActiveSheet.UsedRange
                    r = Cell.Row
                    c = Cell.Column
                    If Cell.Value <> "" Then
                        If Cell.Locked = False Then Cell.Locked = True
                    End If
                Next Cell
                .Protect                            'protect entire sheet
            End With
            
            With Application
                .Calculation = xlCalculationAutomatic
                .DisplayAlerts = True
                .ScreenUpdating = True
            End With
            
        End If
    End Sub
    Last edited by rollis13; 10-17-2013 at 03:25 AM.

Similar Threads

  1. Calculate Time Difference Between Time In HH:MM
    By Stalker in forum Excel Help
    Replies: 8
    Last Post: 03-28-2013, 03:27 PM
  2. Budget Spreadsheet Template
    By rich_cirillo in forum Excel Help
    Replies: 1
    Last Post: 02-12-2013, 10:32 PM
  3. Displayin Date/Time in "original" time zone
    By Rasm in forum Excel Help
    Replies: 4
    Last Post: 04-21-2012, 02:02 AM
  4. Spreading a time range (shift time, etc) in columns.
    By Rajesh Kr Joshi in forum Excel Help
    Replies: 1
    Last Post: 08-23-2011, 11:45 AM
  5. FreezePane In A Userform SpreadSheet Control 11.0
    By Excel Fox in forum Excel and VBA Tips and Tricks
    Replies: 0
    Last Post: 05-15-2011, 05:49 AM

Posting Permissions

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