Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default For i = 5 to 1000 for columns?

Hello there
I am quite often using functions such as
____________
For i = x to whatever
CODE
Next i
___________

but I would also like to use this kind of structure for columns such as

For ? = A to J
CODE
Next ?

But obviously its not this kind of structure anymore, do you know what
to use?

kind regards,
Daniel

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default For i = 5 to 1000 for columns?

Here's one way:
Dim Col As Range
For Each Col In Range("A:F").Columns
Col.ColumnWidth = 12
Next

NickHK
P.S. You know Excel version before the 207 Beta only have 256 columns, so
you can't go as high as 1000.

wrote in message
ups.com...
Hello there
I am quite often using functions such as
____________
For i = x to whatever
CODE
Next i
___________

but I would also like to use this kind of structure for columns such as

For ? = A to J
CODE
Next ?

But obviously its not this kind of structure anymore, do you know what
to use?

kind regards,
Daniel



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default For i = 5 to 1000 for columns?

Hi Daniel,

Try something like:

'=============
Public Sub Tester()
Dim i As Long

For i = 1 To 20 Step 2
Columns(i).Interior.ColorIndex = 6
Next i

End Sub
'<<=============


---
Regards,
Norman



wrote in message
ups.com...
Hello there
I am quite often using functions such as
____________
For i = x to whatever
CODE
Next i
___________

but I would also like to use this kind of structure for columns such as

For ? = A to J
CODE
Next ?

But obviously its not this kind of structure anymore, do you know what
to use?

kind regards,
Daniel



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default For i = 5 to 1000 for columns?

Thats just great Nick, Norman!
many thanks for your help I am just testing all this but I am sure it
will be just fine.
Once again, thanks for your help
Daniel

Norman Jones wrote:
Hi Daniel,

Try something like:

'=============
Public Sub Tester()
Dim i As Long

For i = 1 To 20 Step 2
Columns(i).Interior.ColorIndex = 6
Next i

End Sub
'<<=============


---
Regards,
Norman



wrote in message
ups.com...
Hello there
I am quite often using functions such as
____________
For i = x to whatever
CODE
Next i
___________

but I would also like to use this kind of structure for columns such as

For ? = A to J
CODE
Next ?

But obviously its not this kind of structure anymore, do you know what
to use?

kind regards,
Daniel


Reply
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
devide by 1000 Atiq Excel Discussion (Misc queries) 5 April 29th 09 08:52 PM
1000-200*4% add deepak Excel Discussion (Misc queries) 2 June 26th 07 08:31 AM
1000 to 1 and 1 to 1000 Olle Excel Worksheet Functions 5 October 6th 06 02:41 PM
1000+$K$5/1000 -what does $ indicate in formula Coolbhims Excel Worksheet Functions 1 March 16th 06 11:51 AM
Event ID 1000 LtLeary Excel Programming 0 October 5th 05 11:18 PM


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