Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help! How do I Auto-Update?


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


--
Sethaholic
------------------------------------------------------------------------
Sethaholic's Profile: http://www.excelforum.com/member.php...o&userid=25113
View this thread: http://www.excelforum.com/showthread...hreadid=387598

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 222
Default Help! How do I Auto-Update?

Try using ActiveWorkbook.Name

"Sethaholic" wrote:


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


--
Sethaholic
------------------------------------------------------------------------
Sethaholic's Profile: http://www.excelforum.com/member.php...o&userid=25113
View this thread: http://www.excelforum.com/showthread...hreadid=387598


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sometimes formuli in workbook don't auto update with auto-recal on PE2 Excel Worksheet Functions 1 October 12th 06 03:49 PM
how to update data on sheet1 and have it auto update on sheet2 Tommy Excel Programming 6 May 11th 05 06:41 PM
excel links update not working in auto, calculations in auto Mikey Boy Excel Worksheet Functions 0 December 7th 04 11:53 PM
auto update xyncro Excel Worksheet Functions 1 November 5th 04 02:03 PM
auto update xyncro Excel Worksheet Functions 0 November 5th 04 11:03 AM


All times are GMT +1. The time now is 12:32 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"