Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 101
Default Macro Not Completely Working

As you can see this macro should find a number less than 1000 and then color
it.
It finds the number, however will not color it, and also there may be
multiple cells with less than 1000. Could you help me in getting this macro
to find one and color it and then continue on to the end. Joel has helped
but for some reason his solution does not work.

Sub ColorCellLessThan1000orBlank()

Range("K1").Select

Do Until ActiveCell < 1000
If ActiveCell < 1000 Then
With Selection.Interior
.PatternColorIndex = 7
.Pattern = x1solid
End With

End If
ActiveCell.Offset(1, 0).Select


Loop
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 791
Default Macro Not Completely Working

The macro will not work because is not getting pass K1
You need to do this, note that 11 is the position of Column k you can change
it to any column you want same with the iLastrow Range.


Dim iLastRow as integer
iLastRow=Range("K65536").End(xlUp).Row

For i =1 to iLastRow
Cells(i,11).Activate
If ActiveCell < 1000 Then
With Selection.Interior
.PatternColorIndex = 7
.Pattern = x1solid
End With

End If


Next i
--
If this posting was helpful, please click on the Yes button.
Regards,

Michael Arch.




"Beep Beep" wrote:

As you can see this macro should find a number less than 1000 and then color
it.
It finds the number, however will not color it, and also there may be
multiple cells with less than 1000. Could you help me in getting this macro
to find one and color it and then continue on to the end. Joel has helped
but for some reason his solution does not work.

Sub ColorCellLessThan1000orBlank()

Range("K1").Select

Do Until ActiveCell < 1000
If ActiveCell < 1000 Then
With Selection.Interior
.PatternColorIndex = 7
.Pattern = x1solid
End With

End If
ActiveCell.Offset(1, 0).Select


Loop
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Macro Not Completely Working

Have you tried that code? Doesn't work for me. Also if you are trversing rows
you should use longs and not integers as integers have an upper bound of
approximately 32k...
--
HTH...

Jim Thomlinson


"Michael" wrote:

The macro will not work because is not getting pass K1
You need to do this, note that 11 is the position of Column k you can change
it to any column you want same with the iLastrow Range.


Dim iLastRow as integer
iLastRow=Range("K65536").End(xlUp).Row

For i =1 to iLastRow
Cells(i,11).Activate
If ActiveCell < 1000 Then
With Selection.Interior
.PatternColorIndex = 7
.Pattern = x1solid
End With

End If


Next i
--
If this posting was helpful, please click on the Yes button.
Regards,

Michael Arch.




"Beep Beep" wrote:

As you can see this macro should find a number less than 1000 and then color
it.
It finds the number, however will not color it, and also there may be
multiple cells with less than 1000. Could you help me in getting this macro
to find one and color it and then continue on to the end. Joel has helped
but for some reason his solution does not work.

Sub ColorCellLessThan1000orBlank()

Range("K1").Select

Do Until ActiveCell < 1000
If ActiveCell < 1000 Then
With Selection.Interior
.PatternColorIndex = 7
.Pattern = x1solid
End With

End If
ActiveCell.Offset(1, 0).Select


Loop
End Sub

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
Autofilter Not working completely Steve Excel Discussion (Misc queries) 2 October 29th 08 05:21 PM
Lookup Formula not working completely Newsgal Excel Worksheet Functions 9 April 23rd 08 12:27 AM
Macro Not Completely Working Jim Thomlinson Excel Programming 0 August 17th 07 01:51 AM
send email macro not working completely..... [email protected][_2_] Excel Programming 0 May 17th 07 12:46 PM


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