View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Aquaris Aquaris is offline
external usenet poster
 
Posts: 2
Default AutoFormatting Style Selection

I use the following VBA and it works fine:

Selection.AutoFormat Format:=xlRangeAutoFormatList2, Number:=True, _
Font:=True, Alignment:=True, Border:=True, Pattern:=True, Width:=True

However, I would like to have the Format style as a variable - how do I do
it. I tried this and gotten an "AutoFormat method of Range class failed"
error. My statement is:

vList = "List2"

Selection.AutoFormat Format:="xlRangeAutoFormat" & vList, Number:=True, _
Font:=True, Alignment:=True, Border:=True, Pattern:=True, Width:=True

Any help is appreciated.