distance calculator excel userform

DB73

Board Regular
Joined
Jun 7, 2022
Messages
107
Office Version
  1. 365
  2. 2021
  3. 2019
  4. 2016
  5. 2010
  6. 2007
Platform
  1. Windows
  2. Mobile
  3. Web
Hi peeps,

I have an excel file with a working code and sheet(1) to calculate distance and time between 2 post(zip)codes
i use an google maps API key for that

i have/use an userform to fill in my working hours and travel, it will be saved on a sheet(dump) in the same file.
i also made a matrix with addresses and distance in that file on a different sheet(3).
the userform is only populating the cells on my sheet(dump) with comboxes (from-to) and a formule in a next cell on sheet(dump) finds the distance by a formula index/match

so, my question is,
is it possible to use the same code from my module to run on that userform(textbox or whatever), so it has only the populate the cell on my dump sheet without using the formulas, because the calculation is already done on the userform.
cbx1(from) - cbx2(to) - textbox1(distance)
so the distance has to be calculated on the userform (with or without an action bttn) and then the txtbox should show the travel distance, so i dont need my matrix sheet anymore.

thanks in advance
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

Forum statistics

Threads
1,224,815
Messages
6,181,135
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top