Data Table Refresh Button

napoleon dynamite

New Member
Joined
Jun 2, 2016
Messages
2
I'm working on creating some data tables in an excel worksheet. I know that pressing F9 can refresh data tables but other people are going to be using this sheet and I am trying to make it as simple and obvious as possible that the data tables will need to be refreshed. I'd like to put a button that says "Click Me" or something like that next to each data table. I know that if you go into Developer you can insert a rectangle, right click and assign a macro. Where I'm running into a little bit of trouble is actually assigning the macro/writing VBA itself. I am not exactly sure how to "assign"/write the macro so that after I stop recording, anyone can simply click on the button and the data table is refreshed whenever there is updated data in the rows/columns. I'm pretty sure it's possible to do this as I've seen refresh buttons for other things in excel. Any help is appreciated!
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
If you in the developer tab choose ActiveX button instead of form button, insert that and double click it.
In the window that appears you should see something like:

Code:
Private Sub CommandButton1_Click()

End Sub

If you after the line that says Private Sub CommandButton1_Click() press enter once or twice so you get a new line and then type ThisWorkbook.RefreshAll you should end up with something like this:

Code:
Private Sub CommandButton1_Click()

ThisWorkbook.RefreshAll


End Sub

Go back to the sheet, go out of developer mode and press the button.
 
Upvote 0

Forum statistics

Threads
1,216,096
Messages
6,128,807
Members
449,468
Latest member
AGreen17

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