# Plotting directional arrows on an excel graph

1. ## Plotting directional arrows on an excel graph

Hi,

I wondered if anyone could help. I'd like to plot some marine data - wave heights and direction on a chart. I have seen examples and managed to do some conditional formatting to read the direction originally in degrees and assign it N, S, SW etc. But what I want to do is to have the wave heights plotted as a line graph with the corresponding directional arrows on the same graph above. I believe this has to be using icon sets or with some VBA?

I would appreciate any help please.

Many thanks

Steph

2. ## Re: Plotting directional arrows on an excel graph

Hi Steph. Welcome to the forum. Have you ever dealt with VBA in excel? If not, for what you need to do here, you don't need to know much just patience in understanding what each line of code means. I'd also do some searches on how a "for loop" works in VBA.

Here's what I got from just recording a simple macro and modifying it slightly to accommodate a loop. You'll have to create a picture file for each direction that you want to use.

Let me know if you have any trouble.

This is a slightly more compact code than what's in the attachment, but it does exactly the same thing.

``Please Login or Register  to view this content.``

3. ## Re: Plotting directional arrows on an excel graph

Hi,

I had a look at what you gave me but can't fathom it out - I think I'm lost :-(

4. ## Re: Plotting directional arrows on an excel graph

Lol. What part is not clear specifically?

5. ## Re: Plotting directional arrows on an excel graph

All of it haha. I was trying to work out the code from the shortened version you added but can't see how I would define the datapoints to put in the arrows. Sorry :-)

6. ## Re: Plotting directional arrows on an excel graph

The code basically goes through each data point you have set up in excel in column A and determines what wind direction a particular cell shows. This is the "For data_point = 1 To 8" loop where 8 can be extended to any number you wish (the number of our data points, so it could be 100 if you want).

Then with "If .... Then .... ElseIf .... End If" portion, it checks to see if the direction is "N" (for North) for example, then it would pull out a picture file depicting an arrow pointing up (you have to create this picture yourself). The address of this picture file is C:\Program Files (x86)\Microsoft Office\MEDIA\CAGCAT10\j0149407.wmf on my PC, but you can put it anywhere you want it in yours and just paste in the link and file name into code.

If direction is not "N", it goes to the next iteration and checks if direction is "S", if not, checks if direction is "E" and so on.

Once it finds the picture file for that particular point, it feeds it into the chart, and the goes on to the next point and looks for it's picture file. This is how a "For" loop works.

Welcome to VBA programming It's not that complicated once you really get into it. I started off playing around recording macros and tweaking them, and now can write many pages of code in a day for what I need to do.

7. ## Re: Plotting directional arrows on an excel graph

Hi,

I'll try and take another look at it. Didn't know what you meant by setting up a data point and not sure how you record the macro and where, obviously you're talking to a real novice here with this aspect of Excel ;-) Hey if you're really good at this let me know as I've been thinking of finding a freelancer to set it up for me if I fail - which seems quite likely haha.

Thanks as always for the above.

8. ## Re: Plotting directional arrows on an excel graph

No need for vba. Just use some additional series and formula.

9. ## Re: Plotting directional arrows on an excel graph

Originally Posted by Andy Pope
No need for vba. Just use some additional series and formula.
Wow. Had no idea those symbols existed. That's the way to go.

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1