View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JW[_2_] JW[_2_] is offline
external usenet poster
 
Posts: 638
Default Auto Entering Dates Across Seven Worksheets and Navigating

Sub this()
Dim ws As Worksheet, lCol As Integer, r As Long
r = 12
For Each ws In ActiveWorkbook.Worksheets
With ws
If Left(.Name, 6) = "Period" Then
lCol = .Cells(r, "IV") _
.End(xlToLeft).Column + 1
.Cells(r, lCol).NumberFormat = _
"mm/dd/yy;@"
.Cells(r, lCol).Value = Date
If .Name = "Period 1" Then _
Application.Goto .Cells(r + 3, lCol)
End If
End With
Next ws
End Sub

wrote:
Hello there,
In a workbook with 7 sheets (named Period 1, Period 2, ..., Period 7), I
would like to attach code to a macro that does the following:

1.) Go to the sheet named Period 1,

2.) Find the last used cell in row 12,

3.) Insert today's date into the next cell to the right (formatted mm/
dd/yy).

4.) Do this to all of the sheets whose name starts with "Period."

5.) Lastly, put the cursor 3 cells below the newly entered date on
the sheet named Period 1.

Thank you very much for any and all help on this code.
Tracy