Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA code for searching Particular Column and formating the column 1

Status
Not open for further replies.

rajltd

IS-IT--Management
Sep 25, 2003
38
GB
I am coding a Excel macro in VB for searching a particular column (treat as header) from a number of worksheets in the workbook. That particular column Eg. Accessories, can be in more than one worksheet of the workbook, but it is always in the 3rd column of that particular worksheet (if there) of the workbook. The reason being I want to format the column size from 10 to 50 for that particular column.

Any help will be very much appreciated.

Thanks
 
Hi,

Assuming that your column heading value is Accessories and if it exists on a sheet is in column C row 1...
Code:
for each ws in worksheets
  with ws.cells(1,3)  
    if .value = "Accessories" then
      .entirecolumn.columnwidth=70
    end if
  end with
next
:)

Skip,
Skip@TheOfficeExperts.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top