Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
programme run help | Excel Programming | |||
running a programme | Excel Programming | |||
PROGRAMME HELP | Excel Programming | |||
Does excel VBA programme has a size limit? Or some other problems caused this problem? | Excel Programming | |||
excel vba programme | Excel Programming |