Auto Entering Dates Across Seven Worksheets and Navigating

  • Thread starter Thread starter Racqetsports
  • Start date Start date
R

Racqetsports

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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top