Problem to upload code
(I'm assuming you're using the official Arduino IDE here.)

Before uploading a sketch, you need to select which port you want to upload to. Within the Arduino IDE, click on the Tools menu and open the Port submenu. Click on the port your Arduino is connected to, such as COM3 or COM4.

You also need to ensure the appropriate board type is selected in Tools -> Board.

You should then be able to and upload the sketch.