Hi,
I have one Excel file Insert some data. After i want to Refresh All pls any one guide me
Regards
You can use below activity!
hi @MD_Farhan1
you can refer the below thread
Hi @MD_Farhan1
Sub RefreshAllConnections()
Dim con As WorkbookConnection
' Loop through all connections in the workbook
For Each con In ThisWorkbook.Connections
' Refresh each connection
con.Refresh
Next con
End Sub
Hope it helps!!
i have Many sheets in same excel connect with Data sheet . i want refresh all sheets.
Hi @MD_Farhan1
You can use the below Macors code to refresh the workbook
Sub RefreshAllData()
ThisWorkbook.RefreshAll
End Sub
RefreshAllData.txt (60 Bytes)
Regards
Try this it will refresh all sheets
You have to enable this in Excel to run the macro
Enable macros in your excel
how to do pls step by step instruct me?
Hi @MD_Farhan1
Please enable the macro settings for you excel.
Once you go to the below mentioned view by clicking the file option in excel then you please follow the steps:
After going to macros please enable all those settings and then please run the code
Regards
Please go through this
i want another one clarification. how to set text align center only string column not number column
Hi @MD_Farhan1
Use the below Invoke VBA code:
Sub RefreshAndFormat()
' Refresh all data
ThisWorkbook.RefreshAll
' Set text alignment to center for string columns
Dim ws As Worksheet
Dim col As Range
Dim cell As Range
' Assuming data starts in column A and ends in column Z (adjust as needed)
For Each ws In ThisWorkbook.Sheets
For Each col In ws.UsedRange.Columns
For Each cell In col.Cells
If Not IsNumeric(cell.Value) Then
cell.HorizontalAlignment = xlCenter
End If
Next cell
Next col
Next ws
End Sub
This will refresh all your sheets and string column will be aligned at the center.
ExportToPDF.txt (607 Bytes)
Happy Automation
Regards
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.