I have a HP EliteBook 2540p and I am trying to connect two external monitors to it, but I'm having difficulties. I have a VGA splitter to connect the two monitors. The external monitors have cloned displays whereas the laptop is part of the extended desktop. How can I fix this so as to make use of the two external monitors with the extended desktop setting?
A VGA splitter cable only replicates the video output on both connected displays, it doesn't allow you to use both displays independently. To have two external monitors connected to the 2540p with the desktop extended to both, you need to connect one by VGA and the other by DisplayPort. Note that doing so will disable the laptop's built-in display, as the 2540p is not capable of driving three displays at once, at least not without adding additional graphics hardware (like a USB video adapter or an external GPU via ExpressCard).
This is the guide you're looking for:
I think these two excerpts are particular interesting in regards to your question:
The EliteBook 2540p, 8440p/w, 8540p/w (with NVIDIA graphics), 8740w (with NVIDIA graphics), ProBook 644Xb/645Xb/654Xb/655Xb can output to a maximum of two displays in clone or extended mode via the built-in VGA and DisplayPort (DP) or via the VGA, DVI, and DP on the applicable docking station. The notebook screen is counted as one display so if it is used, only one external display can be used. If the notebook screen is not used, two external displays can be used.
The HP USB Graphics Adapter (NL571AA) can be used to connect up to six additional external displays.
Also, take a look at the table for your model under the "Display resolution specifications" section