Help! How do I Auto-Update?

S

Sethaholic

I have a relatively simple code below. How do I code it so that when I
rename my workbook from "text" to say, "text2", it will automatically
update itself in vba? Is this possible? Thanks!

Sub Convertdates()

Windows("text").Activate
Sheets("Sheet1").Select
Range("I2").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select


For Each cell In Selection
cell.Value = Mid(cell, 5, 2) & "/" & Right(cell, 2) & "/" &
Left(cell, 4)
Next
Selection.NumberFormat = "m/d/yy"
Cells.Find(What:="/0/0", After:=ActiveCell, LookIn:=xlFormulas, LookAt
_
:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False).Activate
Cells.Replace What:="/0/0", Replacement:="0/0/00", LookAt:=xlWhole, _
SearchOrder:=xlByRows, MatchCase:=False


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

Top