Reputation:
can someone tells me what .Refresh
do on excel VBA?
I found some code on the web that enables me to copy content of a text file to excel file.
I have this tool I created using excel vba (this is where I use the code), it's working fine on the first run, but when I use it the second time, it fails.
When I debug it, it highlights the .Refresh
part of the code.
What exactly does this .Refresh
do?
Upvotes: 0
Views: 447
Reputation: 145
Depending on how you have created your code the .Refresh line fails because it does not like the name/DisplayName of the ListObject (the line above the .Refresh line). You need to ensure that no other data tables have the same name. I find it easier to clear all data on the excel worksheet and reload the data rather than refresh the data using the following lines:
Cells.Select
Selection.ListObject.QueryTable.Delete
Selection.ClearContents
Range("A1").Select
I hope this helps.
Upvotes: 0
Reputation: 11
It is the same thing as clicking refresh in the Records menu.
It updates the records in a data sheet after you made changes to the data.
Upvotes: 1