|
-
Jan 19th, 2007, 10:36 AM
#1
Thread Starter
Junior Member
Reading excel file (row,column) and display results
Good morning,
I am working on a calculation process that has various text boxes and combo boxes, and also creates an Excel session and opens the needed Excel file. So far, so good....
What I need to do is compare one of the text box values to a certain row/column on the spreadsheet.
Let's say, text1.Text = "200"
So, now while the Excel worksheet is open and running, it needs to locate where "200" is, by matching text1.Text to a certain row/column variable.
Example:
.....A..........B.........C..........D..........E
1...50........175......100.......75........125
2...60........120.......80........140......110
3...90........200......150.......70........115
Is this very difficult to do? I can get it to open up and display the Excel worksheet, but I don't understand how to compare a value from a text box to a certain row/column of a spreadsheet.
Thank you!
Butch A.
-
Jan 19th, 2007, 10:49 AM
#2
Re: Reading excel file (row,column) and display results
It seems that this may not be the right forum for your question, but I can move it later if needed.
How are you actually working with Excel at the moment?
If you are using automation as shown in my tutorial (which I think you might be, based on your "Just signed up" thread!) then you could use something like this:
VB Code:
If Text1.Text = oXLSheet.Range("B3").Text Then 'or: If Text1.Text = oXLSheet.Cells(3,2).Text Then
Msgbox "Same"
Else
Msgbox "Different"
End if
..I may have mis-interpeted what you meant tho, so tell me if I have!
-
Jan 19th, 2007, 10:59 AM
#3
Thread Starter
Junior Member
Re: Reading excel file (row,column) and display results
Thanks, Si...
Yes, I am using your examples and didn't know exactly which would be the best way to achieve the results.
I didn't know if my VB6 and Excel spreadsheet program should be posted here, but I figured I'd try it here. You can move it back to the Classic VB threads if needed.
Thank you!
Butch A.
-
Jan 19th, 2007, 11:07 AM
#4
Re: Reading excel file (row,column) and display results
I think the "Office Development" forum is probably best, so I have moved it there.
If you have more questions about using Excel from VB, this is the forum that is likely to get the best results (just make sure you specify that you are automating Excel from VB, so that people dont get confused!).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|