I have a query whose refreshOnFileOpen property is set to True. I also have some code (Merge macro) that runs on the OnOpen wkbk function that takes two of the columns brought in by the query and merges them. However, this seems to be happenning out of order.
It merges the columns, then brings in the data, thereby un-merging them again. I have tried all kinds of combinations to get the Merge macro to run after the refresh but none seem to work. Any ideas? Here is the code if that helps:
Private Sub Workbook_Open()
Merge
End Sub
Public Sub Merge()
Dim row As Integer
Dim rowcol As String
row = 25
Do While row < 126
rowcol = "C" & row & ":" & "D" & row
Range(rowcol).Select
With Selection
.MergeCells = True
End With
row = row + 1
Loop
End Sub
It merges the columns, then brings in the data, thereby un-merging them again. I have tried all kinds of combinations to get the Merge macro to run after the refresh but none seem to work. Any ideas? Here is the code if that helps:
Private Sub Workbook_Open()
Merge
End Sub
Public Sub Merge()
Dim row As Integer
Dim rowcol As String
row = 25
Do While row < 126
rowcol = "C" & row & ":" & "D" & row
Range(rowcol).Select
With Selection
.MergeCells = True
End With
row = row + 1
Loop
End Sub