Answered by:
Fourier analysis and screen update
Question

Is it possible to run a Fourier transform in VBA without screen update? For instance if the example code below is run whilst displaying sheet 1, one would expect the analysis results to be written in sheet 2 whilst still displaying sheet 1. However, the screen is updated to show sheet 2? Can anybody suggest a method to run a Fourier transform without the screen being updated?
Sub Macro()
Application.ScreenUpdating = False
Application.Run "Fourier", Sheets("sheet1").Range("$A$1:$A$16"), _
Sheets("sheet2").Range("$I$1"), False, FalseEnd Sub
 Moved by Youen Zen Wednesday, February 1, 2012 3:02 AM (From:Visual Basic General)
Answers

I think your problem is not that the screen flickers, but that you just want to get back to Sheet1 after running the Fourier transform. If that is the case, just include some code to select the original data. Like this,
Sub Macro() Application.ScreenUpdating = False Application.Run "Fourier", Sheets("sheet1").Range("$A$1:$A$16"), _ Sheets("sheet2").Range("$I$1"), False, False Sheets("Sheet1").Activate Range("$A$1").Select End Sub
Ed Ferrero
www.edferrero.com Proposed as answer by danishaniModerator Thursday, February 16, 2012 11:39 PM
 Marked as answer by danishaniModerator Tuesday, February 21, 2012 4:20 PM
All replies

Try the forum for Visual Basic for Applications.
http://social.msdn.microsoft.com/Forums/enUS/isvvba
This one is for Visual Basic with Visual Studio Net
Success
Cor 
Is it possible to run a Fourier transform in VBA without screen update? For instance if the example code below is run whilst displaying sheet 1, one would expect the analysis results to be written in sheet 2 whilst still displaying sheet 1. However, the screen is updated to show sheet 2? Can anybody suggest a method to run a Fourier transform without the screen being updated?
Sub Macro()
Application.ScreenUpdating = False
Application.Run "Fourier", Sheets("sheet1").Range("$A$1:$A$16"), _
Sheets("sheet2").Range("$I$1"), False, FalseEnd Sub
 Merged by danishaniModerator Wednesday, February 1, 2012 3:09 AM duplicate


Dear Bernie
There is no code in sub "Fourier". The Application.Run "Fourier" command runs the Fourier analysis which is part of the Data Analysis Toolpack. If you put any values is sheet1 range A1:A16 the above routine will calculate the Fourier transform and write the results in sheet 2. My question is why it actually displays the results in sheet 2, since the screenupdating = false command should prevent it from doing so? Any suggestions?

Everything is fine. ScreenUpdating prevents monitor updates when the macro is running. It doesn't "disable" screen permanently, when the macro is finished worksheet is updated.
By the way, you should have set Application.ScreenUpdating = true at the end of the macro yourself. Have a look at remarks.

Dear Abcadlo
Thanks for your reply.
The sample code above is just to illustrate that, as far as I can see, one cannot prevent the screen from updating when running a Fourier transform. My problem is that I have a macro that runs the Fourier transform 200 times for 200 different arrays and the screen continuously flickers and updates when it calculates each transform. This is rather distracting and I was wondering how one can prevent the screen from updating? Any suggestions?

Hi Gerhard,
Welcome to MSDN forums.
This is a VBA issue, in order to give you a better support , I will move it from “Visual Basic General” forum to “ Visual Basic for Applications (VBA)” forum.
Thank you for your understanding!
Best regards,
Shanks Zen
MSDN Community Support  Feedback to us

Hi Gerhard,
How about the problem on your side?
Do you still need any assistant about the problem?
If you still show any concern on the problem, just feel free to let us know.
Best Regards,
Daniel van den Berg  Washington, USA  "Anticipate the difficult by managing the easy"

I think your problem is not that the screen flickers, but that you just want to get back to Sheet1 after running the Fourier transform. If that is the case, just include some code to select the original data. Like this,
Sub Macro() Application.ScreenUpdating = False Application.Run "Fourier", Sheets("sheet1").Range("$A$1:$A$16"), _ Sheets("sheet2").Range("$I$1"), False, False Sheets("Sheet1").Activate Range("$A$1").Select End Sub
Ed Ferrero
www.edferrero.com Proposed as answer by danishaniModerator Thursday, February 16, 2012 11:39 PM
 Marked as answer by danishaniModerator Tuesday, February 21, 2012 4:20 PM