LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 158
Default Automatically Accept Replace Values in Text-to-Columns macro

Hello:

Working on a macro to format a report and strip out unnecessary dates,
but in order to do that I need to separate the time from the date. I
first insert a column after the column containing the date field
(DateFld, there are a few of them), then TextToColumns delimited by
"T" for time, and format the date field to a date format.

Every time it gets to the .TextToColumns step, it asks if I want to
replace the data and I want it to automatically do it without prompt.

I know this code could be cleaner, but I'm pretty green at this. Here
it is!

For Each Thing In DateFld
Columns(Thing + 1).Insert Shift:=xlRight
Columns(Thing).Select

With Selection.Columns
.TextToColumns Destination:=Columns(Thing), Other:=True,
OtherChar:="T"
.NumberFormat = "m/d/yyyy"
End With

Rng.AutoFilter Field:=Thing, Criteria1:="<" & RptDate
Range("3:" & Last).SpecialCells(xlCellTypeVisible)
(1).EntireRow.Delete
WS.AutoFilterMode = False
Rng.AutoFilter Field:=Thing, Criteria1:="=" & EndRptDate
Range("3:" & Last).SpecialCells(xlCellTypeVisible)
(1).EntireRow.Delete
WS.AutoFilterMode = False
Next

Thank you!

Steven
 
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
HOW TO REPLACE TEXT AUTOMATICALLY Yuanhang Excel Discussion (Misc queries) 11 December 5th 07 09:35 PM
replace text string in cell automatically Stephen Excel Programming 1 July 16th 07 08:20 AM
replace text string automatically in cell Stephen Excel Discussion (Misc queries) 3 July 1st 07 11:36 PM
How do I automatically accept a solver solution in a macro? clm Excel Programming 1 January 18th 06 05:09 PM
If values in two columns are equal I want to automatically execute a macro Tom Rinks Excel Programming 1 February 1st 04 04:58 PM


All times are GMT +1. The time now is 09:40 PM.

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"