Johnson and he was assigned to light duty as commander of the Valley District in the Shenandoah Valley on May 28, 1863. By June 1863, Gen. Robert E. Lee's Army of Northern Virginia had crossed the Potomac River in the Gettysburg Campaign. Trimble was desperate to get back into action, particularly because he was familiar with the area from his railroad days. He joined Lee's headquarters unsolicited, and wore out his welcome hanging around without formal assignment. Riding north, he caught up with Lt. Gen. Richard S. Ewell on the way to Harrisburg, Pennsylvania, and joined his staff as a supernumerary, or senior officer without a command. He and Ewell quarreled frequently due to this clumsy arrangement and Trimble's lack of tact. At the Battle of Gettysburg, Ewell's Second Corps reached the battlefield in the early afternoon of the first day, July 1, 1863, smashing into the Union XI Corps and driving it south through the town to Cemetery Hill. Trimble wrote the following about his encounter with Ewell: Observers have reported that the "impatient reply" was, "When I need advice from a junior officer I generally ask for it." They also stated that Trimble threw down his sword in disgust and stormed off. A more colorful version of this account has been immortalized in Michael Shaara's novel, The Killer Angels and in the film Gettysburg, where Trimble directly tells Robert E. Lee his feelings about Ewell not taking the hill. On July 3, 1863, Trimble was one of the three division commanders in Pickett's Charge. He stepped in to replace Maj. Gen. W. Dorsey Pender, of Lt. Gen. A.P. Hill's corps, who had been mortally wounded the previous day. Trimble was at a great disadvantage because he had never worked with these troops before. His division participated in the left section of the assault, advancing just behind the division led by Brig. Gen. J. Johnston Pettigrew (formerly by Maj. Gen. Henry Heth). Trimble rode his horse, Jinny, and was wounded in the left leg, the same leg hit at Second Bull Run. Despite feeling faint, the 61-year-old general was able to walk back to the Confederate line on Seminary ridge. His leg was amputated by Dr. Hunter McGuire, and Trimble could not be taken along with the retreating Confederates, because of fear of infection that would result from a long ambulance ride back to Virginia, so he was left