SunQuest
           Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Try It Free
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old July 3rd, 2003, 07:47 AM
a_munro a_munro is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 9 a_munro User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
searching a row in excel

I am having problems searching for an item on a row in a spreadsheet.
I have initialised a variable current_cell as the starting point, setting it to A1

Set current_cell = Sheets("Site Performance Data").Range("A1")

the data is on the first row, starting at A1.

I would like to test that there is data in each cell, using isempty function, if there is this value is put into a combo box.
After the cell ahs been checked current cell is moved onto the next column.

I want to continue going along the row until there is no more data to the right of the current cell. I thought of setting the right border of the last column to be a double line and check each cell for this.

The code I have so far is as follows :


Sub Pop_KPI_CmBx(cmbx As ComboBox)

Dim current_cell As Range

Set current_cell = Sheets("Site Performance Data").Range("A1")
current_cell.Select

While Not (current_cell.Borders(xlEdgeRight).LineStyle = xlDouble)

If Not IsEmpty(current_cell) Then
cmbx.AddItem current_cell.value
End If

current_cell = current_cell.Offset(, 2)


Wend

End Sub



when i run this it goes into an infinite loop. can anyone tell me where ive gone wrong or what i can do differently?

Thanks
Andy

Reply With Quote
  #2  
Old July 9th, 2003, 03:42 PM
NicMic's Avatar
NicMic NicMic is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Cheltenham, England.
Posts: 94 NicMic User rank is Corporal (100 - 500 Reputation Level)NicMic User rank is Corporal (100 - 500 Reputation Level)NicMic User rank is Corporal (100 - 500 Reputation Level)NicMic User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 22 h 35 m 32 sec
Reputation Power: 9
Try changing "current_cell = current_cell.Offset(, 2) " to "SET current_cell = current_cell.Offset(, 2)".

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > searching a row in excel


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway