LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Problem with new programme

Hi All,
I'm new to VBA and am having trouble trying to get excel 2007 to work
out final headings for a boat that hits a cross current, but can't get
the VBA to work.

I input 2 pieces of data, the Ship heading and the Current heading.
From the Ship data one of 4 quadrants is chosen. This works ok.
Then, for each quadrant and depending on the size of the current
heading relative to the ship heading, one of 4 different actions has
to be taken.
eg 1) Ship=current then final = (180-ship)+current
2) Current ship and current <=180 then final = (180-current)
+ship
3) Current 180 and Current <= (180+ship) then final = ship-
(current-180)
4) Current (180+ship) and Current <=360 then final = (current
-180)-ship

Unfortunately, the relative parameters change for each of the 4
quadrants so each will have to be written separately.

But I can't get this second bit to work: I've tried 'if' and 'case' to
no avail. I only get 1) to work or have to cycle through 1), 2) etc
and choose the correct answer.
The answer from this is then fed into the final equation to work out
the course correction. This bit works fine as a normal Excel equation.

So, any help and suggestions you can offer would be gratefully
received.

Tony

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
programme run help paul[_17_] Excel Programming 2 September 11th 07 11:50 AM
running a programme paul[_17_] Excel Programming 9 September 2nd 07 05:20 PM
PROGRAMME HELP paul[_17_] Excel Programming 2 July 30th 07 11:46 AM
Does excel VBA programme has a size limit? Or some other problems caused this problem? [email protected] Excel Programming 3 June 20th 06 05:06 PM
excel vba programme sarasa[_6_] Excel Programming 3 June 14th 04 07:27 AM


All times are GMT +1. The time now is 08:51 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"