J
JU
Hi,
Can anybody help? As the loop goes, things are happening slower and slower and it never ends before consuming whole memory (1MB).
The query getting data from and putting to the same workbook which has a macro running this loop.
Here's my code:
For x = 1 To 25
---'some irrelevant to the issue code---
Range("F1").QueryTable.Refresh BackgroundQuery:=False
---This part may have some significance though I don't think so----
---Copying query results to another place---
Dim wiersz As Integer
wiersz = 2
Do
'Cells(Wiersz, 6).Select
'Selection.Copy
Range("FIRST_FR").Select
ActiveCell.FormulaR1C1 = Sheets("Arkusz2").Cells(wiersz, 6).Value
Selection.Offset(1, 0).Select
ActiveWorkbook.Names.Add Name:="FIRST_FR", RefersToR1C1:=Selection
wiersz = wiersz + 1
Loop Until Sheets("Arkusz2").Cells(wiersz, 6).Value = ""
Next
As I said it starts executing the rest of the code very quickly and then, after every round of refreshing query is getting worse.
Thank you in advance
Jarek
Can anybody help? As the loop goes, things are happening slower and slower and it never ends before consuming whole memory (1MB).
The query getting data from and putting to the same workbook which has a macro running this loop.
Here's my code:
For x = 1 To 25
---'some irrelevant to the issue code---
Range("F1").QueryTable.Refresh BackgroundQuery:=False
---This part may have some significance though I don't think so----
---Copying query results to another place---
Dim wiersz As Integer
wiersz = 2
Do
'Cells(Wiersz, 6).Select
'Selection.Copy
Range("FIRST_FR").Select
ActiveCell.FormulaR1C1 = Sheets("Arkusz2").Cells(wiersz, 6).Value
Selection.Offset(1, 0).Select
ActiveWorkbook.Names.Add Name:="FIRST_FR", RefersToR1C1:=Selection
wiersz = wiersz + 1
Loop Until Sheets("Arkusz2").Cells(wiersz, 6).Value = ""
Next
As I said it starts executing the rest of the code very quickly and then, after every round of refreshing query is getting worse.
Thank you in advance
Jarek