Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 219
Default AutoFormatting Style Selection

Hi Aquarius,
The format is a number. You've attempted to use text so you get an error.
I have listed all the Formats and their appropriate (behind the scenes)
number.

In other words,
Format:=xlRangeAutoFormatList2
and
Format:=11
are the same.

xlRangeAutoFormatSimple -4154
xlRangeAutoFormatNone -4142
xlRangeAutoFormatClassic1 1
xlRangeAutoFormatClassic2 2
xlRangeAutoFormatClassic3 3
xlRangeAutoFormatAccounting1 4
xlRangeAutoFormatAccounting2 5
xlRangeAutoFormatAccounting3 6
xlRangeAutoFormatColor1 7
xlRangeAutoFormatColor2 8
xlRangeAutoFormatColor3 9
xlRangeAutoFormatList1 10
xlRangeAutoFormatList2 11
xlRangeAutoFormatList3 12
xlRangeAutoFormat3DEffects1 13
xlRangeAutoFormat3DEffects2 14
xlRangeAutoFormatLocalFormat1 15
xlRangeAutoFormatLocalFormat2 16
xlRangeAutoFormatAccounting4 17
xlRangeAutoFormatLocalFormat3 19
xlRangeAutoFormatLocalFormat4 20
xlRangeAutoFormatReport1 21
xlRangeAutoFormatReport2 22
xlRangeAutoFormatReport3 23
xlRangeAutoFormatReport4 24
xlRangeAutoFormatReport5 25
xlRangeAutoFormatReport6 26
xlRangeAutoFormatReport7 27
xlRangeAutoFormatReport8 28
xlRangeAutoFormatReport9 29
xlRangeAutoFormatReport10 30
xlRangeAutoFormatClassicPivotTable 31
xlRangeAutoFormatTable1 32
xlRangeAutoFormatTable2 33
xlRangeAutoFormatTable3 34
xlRangeAutoFormatTable4 35
xlRangeAutoFormatTable5 36
xlRangeAutoFormatTable6 37
xlRangeAutoFormatTable7 38
xlRangeAutoFormatTable8 39
xlRangeAutoFormatTable9 40
xlRangeAutoFormatTable10 41
xlRangeAutoFormatPTNone 42

HTH,
--
Gary Brown

If this post was helpful, please click the ''Yes'' button next to ''Was this
Post Helpfull to you?''.


"Aquaris" wrote:

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.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default AutoFormatting Style Selection

Hi Gary,

It solved the problem. Thank you very much.


"Gary L Brown" wrote:

Hi Aquarius,
The format is a number. You've attempted to use text so you get an error.
I have listed all the Formats and their appropriate (behind the scenes)
number.

In other words,
Format:=xlRangeAutoFormatList2
and
Format:=11
are the same.

xlRangeAutoFormatSimple -4154
xlRangeAutoFormatNone -4142
xlRangeAutoFormatClassic1 1
xlRangeAutoFormatClassic2 2
xlRangeAutoFormatClassic3 3
xlRangeAutoFormatAccounting1 4
xlRangeAutoFormatAccounting2 5
xlRangeAutoFormatAccounting3 6
xlRangeAutoFormatColor1 7
xlRangeAutoFormatColor2 8
xlRangeAutoFormatColor3 9
xlRangeAutoFormatList1 10
xlRangeAutoFormatList2 11
xlRangeAutoFormatList3 12
xlRangeAutoFormat3DEffects1 13
xlRangeAutoFormat3DEffects2 14
xlRangeAutoFormatLocalFormat1 15
xlRangeAutoFormatLocalFormat2 16
xlRangeAutoFormatAccounting4 17
xlRangeAutoFormatLocalFormat3 19
xlRangeAutoFormatLocalFormat4 20
xlRangeAutoFormatReport1 21
xlRangeAutoFormatReport2 22
xlRangeAutoFormatReport3 23
xlRangeAutoFormatReport4 24
xlRangeAutoFormatReport5 25
xlRangeAutoFormatReport6 26
xlRangeAutoFormatReport7 27
xlRangeAutoFormatReport8 28
xlRangeAutoFormatReport9 29
xlRangeAutoFormatReport10 30
xlRangeAutoFormatClassicPivotTable 31
xlRangeAutoFormatTable1 32
xlRangeAutoFormatTable2 33
xlRangeAutoFormatTable3 34
xlRangeAutoFormatTable4 35
xlRangeAutoFormatTable5 36
xlRangeAutoFormatTable6 37
xlRangeAutoFormatTable7 38
xlRangeAutoFormatTable8 39
xlRangeAutoFormatTable9 40
xlRangeAutoFormatTable10 41
xlRangeAutoFormatPTNone 42

HTH,
--
Gary Brown

If this post was helpful, please click the ''Yes'' button next to ''Was this
Post Helpfull to you?''.


"Aquaris" wrote:

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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to stop style for col A changing to style of co D date vs $ Knowledge Seeker Setting up and Configuration of Excel 0 April 15th 08 03:26 PM
How do I change sheet notation from R1C1 style to A1 style in XL 2 Sherlock1506 Setting up and Configuration of Excel 1 December 5th 06 03:22 PM
Changing from format style to list style B.W. Excel Worksheet Functions 1 November 22nd 06 07:53 PM
How do I convert US style dates to European style? Neo Excel Discussion (Misc queries) 3 October 15th 06 02:24 PM
can a1 reference style and r1c1 style be used in same formula? rjagga Excel Worksheet Functions 1 September 17th 06 10:58 AM


All times are GMT +1. The time now is 07:58 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"