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: 354
Default exit for loop

Below is color bar VBA to color bar chart. The problem is
if an empty cell exist in range (A2: A9), the program will not working
How can I exit for if an empty cell exit?

THanks
Daniel


--------------------------------------------------------------------------------
Sub colorbarr()



Application.ScreenUpdating = False

Dim Rng As Range
Dim Cnt As Integer

Cnt = 1

For Each Rng In Range("A2:A9")
Set Pts = ActiveChart.SeriesCollection(1).Points(Cnt)
If Rng.Value = "im" Then
Pts.Interior.ColorIndex = 24
ElseIf Rng.Value = "surg" Then
Pts.Interior.ColorIndex = 45
ElseIf Rng.Value = "ms" Then
Pts.Interior.ColorIndex = 19
ElseIf Rng.Value = "other" Then
Pts.Interior.ColorIndex = 35
End If
Cnt = Cnt + 1
Next Rng
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
Exit to the beginning of For Next loop CousinExcel Excel Discussion (Misc queries) 3 May 13th 10 01:03 PM
Loop for X seconds then exit XP Excel Programming 2 March 22nd 07 03:51 AM
exit for next loop David Henderson Excel Programming 2 March 23rd 06 08:07 PM
exit from a loop? Kieran1028[_5_] Excel Programming 0 November 10th 04 02:55 PM
exit from a loop? crispbd[_23_] Excel Programming 0 November 8th 04 09:22 PM


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