#### MattBaldry

##### Self Taught, Learn from the Forums

- Local time
- Today, 08:15

- Joined
- Feb 5, 2019

- Messages
- 325

I have a modified drag and drop planner we use at work that places new activities on the screen with an X and Y coordinate to place it when added.

I am trying to figure out how to work out the next X and Y values based on the last values in the table.

X starts at 10 and increases 3 more times in 20s then increases by 150

Y starts at 25 and increases 3 more times in 15s then resets back to 10

X | Y |

10 | 25 |

30 | 40 |

50 | 55 |

70 | 70 |

220 | 25 |

240 | 40 |

260 | 55 |

280 | 70 |

So the next X and Y would be 430 | 25. Does anyone have an idea on how I could make this work so when a new job is added to the planner, it allocated the correct X and Y?

Something like

IIf LastOfY = 70 then X = LastOfX + 150 And Y = 25 else Y = LastOfY +20 And X = LastOfX +15?

I have never written anything like this so not sure of the correct VBA or layout.

Once the jobs are moved onto the calendar part, the X and Y coordinates for that job become 0 | 0 and all the others are moved to a new correct position, but the planner already does this. I am only looking for new jobs added.

I really hope I have made something close to sense here.

~Matt