LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 220
Default Check values before running macro

Fixed it... Thanks again for all your help Merjet!
-- Dan

Sub Clean_Data_File()
Dim iEnd As Long
Dim ws As Worksheet
Dim c As Range
Dim rng As Range
Dim iCt As Integer

Application.ScreenUpdating = False

Set ws = ActiveSheet
iEnd = ws.Cells(65536, 19).End(xlUp).Row
Set rng = ws.Range(ws.Cells(3, 19), Cells(iEnd, 19))
For Each c In rng
If InStr(c, "/") = False Then _
c = Mid(c, 4, 2) & "/" & Mid(c, 6, 2) _
& "/" & "20" & Mid(c, 2, 2)
Next c

iEnd = ws.Cells(65536, 20).End(xlUp).Row
Set rng = ws.Range(ws.Cells(3, 20), Cells(iEnd, 20))
For Each c In rng
If InStr(c, "/") = False Then _
c = Mid(c, 4, 2) & "/" & Mid(c, 6, 2) _
& "/" & "20" & Mid(c, 2, 2)
Next c

iEnd = ws.Cells(65536, 16).End(xlUp).Row
Set rng = ws.Range(ws.Cells(3, 16), Cells(iEnd, 16))
For Each c In rng
If InStr(c, "-") = False Then _
c = Mid(c, 5, 2) & "-" & Mid(c, 1, 3) _
& "-" & Mid(c, 8, 4)
Next c

Application.ScreenUpdating = True

End Sub



 
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
Clearing Check Boxes & Running a diff Macro when unchecking the ch Vick Excel Discussion (Misc queries) 6 May 30th 07 08:44 PM
How to check a cell for content before running macro. Incoherent Excel Programming 1 October 7th 05 04:42 PM
How to Check if a Process is Running Chaplain Doug Excel Programming 0 May 24th 05 05:29 PM
check for running app L3Tech Excel Programming 6 February 20th 04 12:50 AM
Check for Excel version before running? Ed[_9_] Excel Programming 2 December 18th 03 01:56 PM


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

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

About Us

"It's about Microsoft Excel"