PDA

Click to See Complete Forum and Search --> : Excel and cell formating from vb


jritchie
Dec 13th, 1999, 09:06 AM
Two questions.

1. How do you increase the width of an excel column to match the length of the longest piece of data put into it. Have tried using len from within vb but this still doesn't seem to increase the width to the widest required.

2. How do you insert a heading into Row 0, and then centre it over the columns in the worksheet, once again from within code in vb.

Have tried recording macros etc in Excel with no success.

R@emdonck
Dec 13th, 1999, 09:14 AM
Hi,

Mail your question to kenx@jpi.mozcom.com !!
He might give you an answer. (He gave me some great code for Excell a few days ago)

R@emdonck

PietHein
Dec 13th, 1999, 05:42 PM
About fitting to the length of your cell.
I recorded a macro and looked at the code

Columns("A:A").Select
Selection.Columns.AutoFit

This is the same as: Format - column- autofit selection. (in excel 95)

SU