LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 132
Default Formating multiple cols from text to No

I have a data sheet that ocassionally has the lower half values remain as
text when I copy new data. I have produced the following macro to convert
the selected cols to either date or number format. There are many more
columns to convert to number format than shown. I've trimmed some of the
default code entered by the macro recorder to what I think is the minimum
required. Is there a more compact version of the code I can use to get the
same result. I also wan this to run on cahnges to the sheet (ie; when new
data is copied in).


Sub ColToNum()

Columns("K:K").Select 'number format
Selection.TextToColumns , DataType:=xlDelimited, FieldInfo _
:=Array(1, 1)
Columns("M:M").Select 'number format
Selection.TextToColumns , DataType:=xlDelimited, FieldInfo _
:=Array(1, 1)
Columns("Q:Q").Select 'number format
Selection.TextToColumns , DataType:=xlDelimited, FieldInfo _
:=Array(1, 1)
Columns("R:R").Select 'number format
Selection.TextToColumns , DataType:=xlDelimited, FieldInfo _
:=Array(1, 1)
Columns("E:E").Select 'date format
Selection.TextToColumns , DataType:=xlDelimited, FieldInfo _
:=Array(1, 4)
Columns("G:G").Select 'date format
Selection.TextToColumns , DataType:=xlDelimited, FieldInfo _
:=Array(1, 4)
End Sub

Any suggestions appreciated.

--
Jim
 
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
2 Cols To 2 Cols VLookup Comparison CuriousMe Excel Discussion (Misc queries) 4 December 21st 06 07:54 PM
How do I perform multiple formating within a single line of text? TroyG Excel Worksheet Functions 2 October 13th 06 04:27 AM
conditional formating on rows & cols depending on one cell bandy2000 Excel Discussion (Misc queries) 1 March 7th 06 11:46 PM
Macro for single to multiple cols. Help! dfkelly42 New Users to Excel 5 July 1st 05 09:07 PM
Cond Format:re color 2 cols, skip 2 cols Tat Excel Worksheet Functions 2 June 22nd 05 06:43 PM


All times are GMT +1. The time now is 05:41 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"