ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need a 'Refresh' button (https://www.excelbanter.com/excel-programming/407273-need-refresh-button.html)

cbrammer

Need a 'Refresh' button
 
We are moving data from a database to Excel. We need the Excel spreadsheet to
update as we make changes in the database. What I need is to put a 'button'
on the spreadsheet that will refresh the data as we make changes in the
database. I know I need to code it in VB. Can anyone lead in me in a
direction? Thanks.

FSt1

Need a 'Refresh' button
 
hi
you need to select a cell inside the query range.....
Private Sub CommandButton1_Click()
sheets("sheet1").activate
Range("A2").QueryTable.Refresh BackgroundQuery:=False
end sub

regards
FSt1

"cbrammer" wrote:

We are moving data from a database to Excel. We need the Excel spreadsheet to
update as we make changes in the database. What I need is to put a 'button'
on the spreadsheet that will refresh the data as we make changes in the
database. I know I need to code it in VB. Can anyone lead in me in a
direction? Thanks.


Nigel[_2_]

Need a 'Refresh' button
 
or more directly.....

Private Sub CommandButton1_Click()
With Sheets("Sheet1").Range("A2")
.QueryTable.Refresh BackgroundQuery:=False
End With
End Sub


--

Regards,
Nigel




"FSt1" wrote in message
...
hi
you need to select a cell inside the query range.....
Private Sub CommandButton1_Click()
sheets("sheet1").activate
Range("A2").QueryTable.Refresh BackgroundQuery:=False
end sub

regards
FSt1

"cbrammer" wrote:

We are moving data from a database to Excel. We need the Excel
spreadsheet to
update as we make changes in the database. What I need is to put a
'button'
on the spreadsheet that will refresh the data as we make changes in the
database. I know I need to code it in VB. Can anyone lead in me in a
direction? Thanks.




All times are GMT +1. The time now is 07:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com