Is there way that I can check if compiled by unreal editor or visual studio?

Is there something that I can use like

#IF UNREAL_EDITOR

     //Then Excecute some code

#IF VISUAL_STUDIO

  //Then Some Code

I want some of my code to be compiled if and only if compiled with Unreal Editor.
Is it possible ?

The Editor doesn’t compile code - both the Editor and Visual Studio use the Unreal Build System to compile Unreal projects. Could you explain a bit more what you’re trying to do?