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: 2
Default Looping through columns

Excel 2003

Hello.
I have this code from a macro and am looking to streamline it:

<begin macro
Columns("A:A").Select
Selection.NumberFormat = "General"

Columns("B:B").Select
Selection.NumberFormat = "General"

Columns("C:C").Select
Selection.NumberFormat = "General"

Columns("D:D").Select
Selection.NumberFormat = "@"

Columns("E:E").Select
Selection.NumberFormat = "@"

Columns("F:F").Select
Selection.NumberFormat = "General"

Columns("G:G").Select
Selection.NumberFormat = "@"

Columns("H:H").Select
Columns("I:I").Select
Selection.NumberFormat = "@"

Columns("J:J").Select
Selection.NumberFormat = "0"

Columns("K:K").Select
Selection.NumberFormat = "0"
<end macro

I am not sure how to set up code to loop through an .XLS file to get the
sheetname, count the valid columns and rows (column/row numbers can
change from month to month)
Then as I loop through each column if it is A,B,C, or F then set
numberformat to "General", etc.....

Do I have to invoke the Excel Object -and- the Workbook object, -and-
the sheet object? This is where I get confused.

Thnx....


*** Sent via Developersdex http://www.developersdex.com ***
 
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
Looping through columns Mick[_2_] Excel Programming 1 February 7th 08 07:27 PM
looping across columns in range? Amy Excel Discussion (Misc queries) 3 July 19th 05 08:01 PM
Looping thru columns Robert Excel Programming 5 June 15th 05 09:48 AM
Looping through columns teresa Excel Programming 2 December 31st 04 07:25 PM
Looping thru columns beyond Z John Pierce Excel Programming 3 January 23rd 04 12:17 AM


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