Results 1 to 7 of 7

Clearing date and resetting for the week

Threaded View

desk.doc Clearing date and resetting... 08-02-2007, 09:42 PM
FrankBoston I've edited your VBA... 08-02-2007, 10:29 PM
desk.doc Thank you for your time on... 08-02-2007, 10:49 PM
davesexcel This seems to work ... 08-02-2007, 10:55 PM
desk.doc Thank you for the reply Dave.... 08-02-2007, 11:27 PM
davesexcel Hi , Maybe it would just be... 08-03-2007, 12:15 AM
desk.doc I hadn't thought of that.... 08-03-2007, 12:30 AM
  1. #1
    Registered User
    Join Date
    07-11-2007
    Location
    Orlando, Florida
    Posts
    48

    Smile Clearing date and resetting for the week

    Hi all
    I had some help the other day with clearing the ranges on all of the unlocked cells in my workbook. Another issue has come up and I am wondering if someone can help me with this. When the ranges on the sheet are cleared, I want to "reset" the date as well. I have almost no programming skills, a little in C++ and a little in C#, but none in vb. Below is the code I am using, which is compiling wrong, and the worksheet is attached. It's a basic sheet. The first code is activated by a button. The second code, I thought, would be activated through the other code. Thanks in advance.

    Private Sub button_Delete_Click()
        Dim response
        Dim AllSheet
        
        response = MsgBox("You are about to clear all numbers. Proceed? R", vbYesNo)
        
        If response = vbYes Then
        Application.ScreenUpdating = False
    
            For Each AllSheet In ActiveWorkbook.Worksheets
            Sheets(AllSheet.Name).Activate
            ActiveSheet.UsedRange.Select
    
            For Each rng In Selection
            If rng.Locked = False Then
            rng.ClearContents
            
            End If
    
        Next rng
        Next AllSheet
        
        End If
        
        ResetDate()
        
        Sheets(1).Activate
        Range("E23").Select
        
        Application.ScreenUpdating = True
    End Sub
    Private Sub ResetDate()
        Dim AllSheet
        
        For Each AllSheet In ActiveWorkbook.Worksheets
        Sheets(AllSheet.Name).Activate
        
        Range("J2").Select
        
        For Each rng In Selection
        rng.ClearContents
        
        ActiveCell = Format$(Format$(ActiveCell, "##/##/####"), "dd/mm/yyyy")
        ActiveCell = TODAY()
        
        Next rng
        Next AllSheet
    End Sub
    Attached Files Attached Files

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