Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Anyone see the prob in this code?


Private Sub CommandButton1_Click()
sheets("sheet3").Range("A1").Select
For I = 1 To 191
While Len(ActiveCell.Value) 0
If ActiveCell.Interior.ColorIndex = 37 Then
UserForm1.ComboBox1.AddItem (ActiveCell.Value)
ElseIf ActiveCell.Interior.ColorIndex = xlNone Then
ActiveCell.Offset(1, 0).Select
End If
ActiveCell.Offset(1, 0).Select
Wend
Next I
CommandButton2.Enabled = True

End Sub

The problem Im getting is that it isn't getting all the values into th
combobox? It usually only gets 3.

Thank

--
Josep

-----------------------------------------------------------------------
Joseph's Profile: http://www.excelforum.com/member.php...nfo&userid=563
View this thread: http://www.excelforum.com/showthread.php?threadid=26545

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Anyone see the prob in this code?

I just tried it and set 10 cells to that colour and got them all!

--

HTH

RP

"Joseph" wrote in message
...

Private Sub CommandButton1_Click()
sheets("sheet3").Range("A1").Select
For I = 1 To 191
While Len(ActiveCell.Value) 0
If ActiveCell.Interior.ColorIndex = 37 Then
UserForm1.ComboBox1.AddItem (ActiveCell.Value)
ElseIf ActiveCell.Interior.ColorIndex = xlNone Then
ActiveCell.Offset(1, 0).Select
End If
ActiveCell.Offset(1, 0).Select
Wend
Next I
CommandButton2.Enabled = True

End Sub

The problem Im getting is that it isn't getting all the values into the
combobox? It usually only gets 3.

Thanks


--
Joseph


------------------------------------------------------------------------
Joseph's Profile:

http://www.excelforum.com/member.php...fo&userid=5637
View this thread: http://www.excelforum.com/showthread...hreadid=265451



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Anyone see the prob in this code?


Not sure of your exact error, but I'd change the code to this:

Private Sub CommandButton1_Click()

Sheets("Sheet3").Range("A1").Select
Dim r As Range

For Each r In Range("A1:A191")
If r.Interior.ColorIndex = 37 Then UserForm1.ComboBox1.AddIte
(r.Value)
Next
CommandButton2.Enabled = True

End Sub



--
kkkni
-----------------------------------------------------------------------
kkknie's Profile: http://www.excelforum.com/member.php...nfo&userid=754
View this thread: http://www.excelforum.com/showthread.php?threadid=26545

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
prob with dates in VBA dee Excel Discussion (Misc queries) 3 March 4th 08 02:19 PM
CSE Formula Prob pdberger Excel Worksheet Functions 4 February 16th 08 03:51 AM
vlookup prob with all #n/a's Janis Excel Discussion (Misc queries) 5 July 30th 07 10:26 PM
Counting prob superkopite Excel Discussion (Misc queries) 13 January 23rd 06 09:18 AM
if function prob Manisha[_2_] Excel Programming 2 April 23rd 04 03:46 PM


All times are GMT +1. The time now is 09:54 PM.

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"