ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Apply format to whole column depending on row 1 contents (https://www.excelbanter.com/excel-programming/376897-apply-format-whole-column-depending-row-1-contents.html)

styne666

Apply format to whole column depending on row 1 contents
 
This is what I want the script to do, but how do I write it?

' ===============================
Look through ActiveSheet.UsedRange

if <the first cell in column contains (text1, text2 or text3)
whole column
width: auto
top cell only in column
text direction: horizontal
text align: h-left, v-bottom
rest of cells in column
text direction: horizontal
text align: h-left, v-middle

if <the first cell in column contains anything else
whole column
width: 4
top cell only in column
text direction: vertical
text align: h-center, v-bottom
rest of cells in column
text direction: horizontal
text align: h-right, v-middle

move to next column and repeat until reached the end of
ActiveSheet.UsedRange
' <===============================

Hope this is clear!

Kind Regards,
Samuel Harmer


All times are GMT +1. The time now is 11:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com