Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default macro that loops to multiple columns

it's a simple macro that i've created, because I'm still a newbie at all of
this.

basically, the macro goes down each cell in a column, and if the cell's
value is greater than 300, then it puts in a background color into the cell.
the macro stops when the cell has nothing in it (the end of the column). I'd
like it to jump to the next column and repeat the macro, but not sure how to
do it. Here's what I've got so far:

Sub testcolors()
ActiveCell.Select
Do Until ActiveCell = ""
If ActiveCell = "" Then End
ActiveCell.Select
If ActiveCell 300 Then
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
End If
ActiveCell.Offset(1,0).Activate
Loop
End Sub

Not even sure if this is the right way to write the macro.....
Any help is greatly appreciated. Thanks.
Brad



  #2   Report Post  
Posted to microsoft.public.excel.programming
acw acw is offline
external usenet poster
 
Posts: 19
Default macro that loops to multiple columns

Brad

If you can select the entire range, then the following
should give you what you are chasing.

Tony

Sub aaa()
Range("a1:c10").Select
ActiveCell.CurrentRegion.Select
For Each ce In Selection
If ce.Value 300 Then
With ce.Interior
.ColorIndex = 6
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
End If
Next ce

End Sub
-----Original Message-----
it's a simple macro that i've created, because I'm still

a newbie at all of
this.

basically, the macro goes down each cell in a column, and

if the cell's
value is greater than 300, then it puts in a background

color into the cell.
the macro stops when the cell has nothing in it (the end

of the column). I'd
like it to jump to the next column and repeat the macro,

but not sure how to
do it. Here's what I've got so far:

Sub testcolors()
ActiveCell.Select
Do Until ActiveCell = ""
If ActiveCell = "" Then End
ActiveCell.Select
If ActiveCell 300 Then
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
End If
ActiveCell.Offset(1,0).Activate
Loop
End Sub

Not even sure if this is the right way to write the

macro.....
Any help is greatly appreciated. Thanks.
Brad



.

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
Macro to add Multiple columns jlclyde Excel Discussion (Misc queries) 5 February 3rd 09 05:27 PM
I need a macro to transpose multiple columns A1-Z1, A2-X2 etc Wombat62 Excel Discussion (Misc queries) 7 September 18th 06 05:05 AM
For next loops Kate Excel Discussion (Misc queries) 5 May 22nd 06 01:11 PM
macro to compile columns on multiple sheets simonsmith Excel Discussion (Misc queries) 2 May 9th 06 04:06 PM
Macro to align and compare multiple rows and columns Manav Ram via OfficeKB.com New Users to Excel 1 March 5th 05 12:38 AM


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