×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Simple task for VBA superstar :)

Simple task for VBA superstar :)

Simple task for VBA superstar :)

(OP)
I have a txt file with 3 columns.

1st column: cityid1

2nd column: cityid2

3rd column: distance between cityid1 and cityid2

My question is... How I can read that data from txt file, have one dropdown list (choose 1st city), then based on that dropdown, choose second dropdown list (choose a city), and then get the distance as the final result.

Thank you very much for reading this, and help.

RE: Simple task for VBA superstar :)

Hi,

There's a really easy way to get your answer using a native Excel Feature inherent to Excel 2007+.

IMPORT your file and use the dropdown filters you get on IMPORT.

BTW, VBA implies that some application, like Excel for instance, is open and running some code. Hence my suggestion in paragraph 1 & 2 above.

BTOW, I do have a VBA, SQL solution. THE VBA is required only to assure any Path and Workbook Name. It uses native Excel features of MS Parameter Query and Data Validation drop down boxes.

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

"The most incomprehensible thing about the universe is that it is comprehensible" A. Einstein

RE: Simple task for VBA superstar :)

(OP)
Can you please, show me/send to me VBA solution...

I'm familiar with Excel etc...

I need to have VBA form, code...

Thank you very much.

RE: Simple task for VBA superstar :)

I will walk you through the process.

First, IMPORT your text file into an empty sheet of your workbook.
1) Add your field headings to Row 1, starting in column A
cityid1
cityid2
distance


2) via Data > Get external data > From TEXT files... and drill down to your text file and follow the steps in the IMPORT wizard.
3) name this sheet IMPORT

When you get that done, add a sheet named QUERY and a sheet named DASHBOARD with three columns:
cityid1
cityid2
distance


SAVE your workbook as a Macro Enabled Workbook

Post back for the next step.

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

"The most incomprehensible thing about the universe is that it is comprehensible" A. Einstein

RE: Simple task for VBA superstar :)

(OP)
Thank you very much for the help so far...

But, I don't need solution that is excel related...

I need it all done in microsoft visual studio...

Code+Form... That's it.

Or, I am wrong...

Once again, thanks for the help & support.

RE: Simple task for VBA superstar :)

>Simple task for VBA superstar
>I need it all done in microsoft visual studio...

Er ... VBA and Visual Studio have pretty much nothing to do with each other. Or do you mean VBA IDE?

(In other words, are you looking for a VB.NET solution or a VBA solution?

RE: Simple task for VBA superstar :)

(OP)
Yes! My bad!

I am so sorry for this misunderstanding...

Can you do it?

Thank you.

RE: Simple task for VBA superstar :)

You, daggg011, sound to me just like a user I've encountered on several occasions.

This is not a free coding service. The site is Tek-Tips, with the emphasis on Tips.

BTW, you didn't even bother to reply to strongm's two questions before asking for a handout, as usual.

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

"The most incomprehensible thing about the universe is that it is comprehensible" A. Einstein

RE: Simple task for VBA superstar :)

(OP)
Like, I said... I needed help,and support...It's all crystal clear.

Don't know what's wrong with that...

RE: Simple task for VBA superstar :)

Sounds like a homework to me.
This is what my teacher asked for, I don't want to lift a finger, so give me ready to use code or I will get very upset about any other response and refuse to answer any questions.

We've been here before....

Quote (strongm)

are you looking for a VB.NET solution or a VBA solution?

Quote (daggg011)

Yes! My bad!

It's all crystal clear.

No, it is not clear at all hairpull

---- Andy

There is a great need for a sarcasm font.

RE: Simple task for VBA superstar :)

It's gone very quiet ...

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close