Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / December 2007

Tip: Looking for answers? Try searching our database.

Range query

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Steve - 06 Dec 2007 17:34 GMT
HI all,
Am using the code below to operate a combobox, but would like it to
read the information from the top line of the worksheet, currently is
reading down

Any help with this would be appreciated,

Private Sub userform_Activate()
Dim iLastRow As Long
Dim i As Long
   With Worksheets("Work Data")
       iLastRow = .Cells(.Rows.Count, "1").End(xlUp).Row
       Me.ComboBox1.Clear
       For i = E To iLastRow
           Me.ComboBox1.AddItem .Cells(i, "1").Value
       Next i
   End With
End Sub

HYCH

Steve
Dave Peterson - 06 Dec 2007 19:35 GMT
I'm not sure I understand, but maybe...

Change this:
For i = E To iLastRow
to
For i = iLastRow to E step -1

(I'm not sure what E is, either.)

> HI all,
> Am using the code below to operate a combobox, but would like it to
[quoted text clipped - 18 lines]
>
> Steve

Signature

Dave Peterson

Steve - 06 Dec 2007 19:44 GMT
> I'm not sure I understand, but maybe...
>
[quoted text clipped - 33 lines]
>
> - Show quoted text -

sorry dave i was trying to adjust the code i had to read across
columns rather than reading down rows.

the original code had that as: For i = 1 To iLastRow

i expected that the no indicated row numbers where as columns are
usually represnted by Letters,

obviously not the right method lol.

All i am looking for is my combobox to read accross the columns rather
than down the rows
Dave Peterson - 06 Dec 2007 19:49 GMT
dim lastCol as long
dim i as long
With worksheets("work data")
 'I used row 1
 lastcol = .cells(1, .columns.count).end(xltoleft).column
 Me.ComboBox1.Clear
 for i = 1 to lastcol
     Me.ComboBox1.AddItem .Cells(1, icol).Value
     ....
 

> > I'm not sure I understand, but maybe...
> >
[quoted text clipped - 46 lines]
> All i am looking for is my combobox to read accross the columns rather
> than down the rows

Signature

Dave Peterson

Steve - 06 Dec 2007 19:52 GMT
> dim lastCol as long
> dim i as long
[quoted text clipped - 62 lines]
>
> - Show quoted text -

Dave,

Just knew you would have the answer as soon as i made myself clear
lol, again thanks :)

Steve
Dave Peterson - 06 Dec 2007 21:22 GMT
I think a lot of people were confused with your question <vbg>.  Your original
post had gone a couple of hours without a response.  That usually means that
there's confusion on at least one end <bg>.

<<snipped>>

> Dave,
>
> Just knew you would have the answer as soon as i made myself clear
> lol, again thanks :)
>
> Steve

Signature

Dave Peterson

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.