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: 16
Default macro error when formatting columns

I am using the following script to format columns in two worksheets
upon opening a workbook. There will not always be data in the selected
columns. My problem is the macro errors when there is no data
present. How can I bypass the errors and complete the macro for the
other columns that do have data?


Sheets("All Other Funds Centers").Select
Columns("E:E").Select
Selection.TextToColumns Destination:=Range("E1"),
DataType:=xlDelimited, _
TextQualifier:=xlSingleQuote, ConsecutiveDelimiter:=False,
Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False,
FieldInfo _
:=Array(1, 1), TrailingMinusNumbers:=True
Columns("G:G").Select
Selection.TextToColumns Destination:=Range("G1"),
DataType:=xlDelimited, _
TextQualifier:=xlSingleQuote, ConsecutiveDelimiter:=False,
Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False,
FieldInfo _
:=Array(1, 1), TrailingMinusNumbers:=True


Range("A57").Select
Sheets("Spec Init - 10059 & 10080").Select
Columns("E:E").Select
Selection.TextToColumns Destination:=Range("E1"),
DataType:=xlDelimited, _
TextQualifier:=xlSingleQuote, ConsecutiveDelimiter:=False,
Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False,
FieldInfo _
:=Array(1, 1), TrailingMinusNumbers:=True
Columns("G:G").Select
Selection.TextToColumns Destination:=Range("G1"),
DataType:=xlDelimited, _
TextQualifier:=xlSingleQuote, ConsecutiveDelimiter:=False,
Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False,
FieldInfo _
:=Array(1, 1), TrailingMinusNumbers:=True
Range("A57").Select
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
Error message when adding 2 columns with Macro Bob Excel Programming 3 March 18th 08 02:27 PM
Right() error changing columns in macro S Himmelrich Excel Programming 8 December 13th 07 12:48 AM
error: Excel encountered an error and had to remove some formatting to avoid corrupting the workbook; please recheck your formatting carefully Keith Excel Programming 0 January 31st 07 05:38 PM
Macro for formatting columns with dates, weekdays, and widths? [email protected] Excel Programming 0 January 27th 05 07:19 PM
First four columns lose formatting when DAO macro is run Alex Barrow-Williams Excel Programming 0 November 24th 03 10:31 AM


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