Exhibit 23 Consent of Ernst & Young LLP, Independent Auditors We consent to the incorporation by reference in the following Registration Statements . Form S-8, No. 333-76847, and . Form S-8, No. 333-83998 of our report dated February 14, 2003, with respect to the consolidated financial statements of Trex Company, Inc. included in this Annual Report (Form 10-K) for the year ended December 31, 2002, filed with the Securities and Exchange Commission. /s/ Ernst & Young LLP McLean, Virginia March 17, 2003