ODBC Connection to SQL Database - display the last refreshed date for a worksheet

btamulis

New Member
Joined
Mar 17, 2010
Messages
17
I have a simple one worksheet refreshable excel file that I simply want to add a visual aid to end user which shows the last refreshed date.

The worksheet does not refresh upon open - end user should open the file see the last date refreshed and if the end user refreshes - the date should show the current date of the refresh.

Seems simple - but I don't any program related functions, so I suspect I have to write some code. Any guidance would be appreciated. I did search the forum prior to posting and I didn't see anything the same as my question - I have no pivot tables or data tables - just a simple straight ODBC connection that fires a SQL Stored Procedure.

Thanks in advance
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
in your query you import from sql, add a query field: DateImported: Date()
(or any label you wish)
 
Upvote 0
in your query you import from sql, add a query field: DateImported: Date()
(or any label you wish)
I appreciate the suggestion - I was hoping to not alter any of the columns in the worksheet. I want to have a single cell in the top roll (data starts in row 3) that returns the last refreshed date.

I'm not even certain if what I would like is even possible - picture a date field (cell) that when end user clicks 'refresh' populates with current date. But only changes based upon the click refresh button. So, if I refresh - I get today's date. If I open tomorrow (but don't refresh - field still has today's date).

Any other thoughts?
 
Upvote 0
in code that does the refresh , add: range("[your cell addr]").value = Date()
There is no code that refreshes the worksheet - end user clicks refresh all on the top toolbar - I would think there is some VBA code that I could write that says 'when the refresh all gets clicked - auto populate cell with current date. Here's a screen shot of what I would like to do:
1698089616290.png

Thanks in advance for your help and patience - the ODBC connection is a straight forward connection there's no code that creates the connection and returns the data.
 
Upvote 0
I would convert your ODBC connection to Power Query. There you have so much more possibilities for transforming data
 
Upvote 0

Forum statistics

Threads
1,215,123
Messages
6,123,183
Members
449,090
Latest member
bes000

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