Exporting a Query to a Spreadsheet
-
- 4StarLounger
- Posts: 528
- Joined: 26 Jan 2010, 15:14
Re: Exporting a Query to a Spreadsheet
Thanks again for your heads-up, in any case, without your magic piece of code, even the accdb version still doesn't produce the correct results in the ProdvsBDG-mese sheet.
-
- 4StarLounger
- Posts: 528
- Joined: 26 Jan 2010, 15:14
Re: Exporting a Query to a Spreadsheet
I have a similar problem of recalculation for the formula in cell F22 on the Nomi sheet of the linked Stat.xlsx in that, once you press the Previous Month button on the startup form of the accdb from the link above, the formula =+MONTH(qt!A2) returns 1 while it should be 3.
I've tried to solve it by reusing your magic code
' For Each cel In xlSheet.UsedRange.SpecialCells(xlCellTypeFormulas)
' cel.Formula = cel.Formula
' Next cel
but this time I get the message, "No cells were found"
I've tried to solve it by reusing your magic code
' For Each cel In xlSheet.UsedRange.SpecialCells(xlCellTypeFormulas)
' cel.Formula = cel.Formula
' Next cel
but this time I get the message, "No cells were found"
-
- Administrator
- Posts: 78545
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Exporting a Query to a Spreadsheet
You're trying to run this code on the qt sheet:
But that sheet doesn't contain any formulas. You can use the code for ProdvsBDG-mese (which you already do) and for Nomi (which you don't).
Code: Select all
Set xlSheet = xlBook.Sheets("qt")
xlSheet.Columns("A:A").EntireColumn.AutoFit
Dim cel As Range
For Each cel In xlSheet.UsedRange.SpecialCells(xlCellTypeFormulas)
cel.Formula = cel.Formula
Next cel
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 528
- Joined: 26 Jan 2010, 15:14