Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Everyone,
I have a Macro that Produces Results Starting in "A1" and Continues Vertically. The Results Could Possible Use Several Columns. I have Tried Using the Following Code to Set the Columns "A:IV" to be AutoFit, Centred and Texted, But for Some Reason it will NOT Work. Has Anyone got Any Suggestions Please. Here is the Code :- Sheets("Results").Select Columns("A:IV").AutoFit Columns("A:IV").HorizontalAlignment = xlCenter Columns("A:IV").NumberFormat = "@" ' Set to Text. Range("A1").Select Thanks in Advance. All the Best Paul Windows XP - Excel 2002 *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Paul,
Your code worked fine for me. Perhaps your sheet is protected? HTH, Bernie MS Excel MVP "Paul Black" wrote in message ... Hi Everyone, I have a Macro that Produces Results Starting in "A1" and Continues Vertically. The Results Could Possible Use Several Columns. I have Tried Using the Following Code to Set the Columns "A:IV" to be AutoFit, Centred and Texted, But for Some Reason it will NOT Work. Has Anyone got Any Suggestions Please. Here is the Code :- Sheets("Results").Select Columns("A:IV").AutoFit Columns("A:IV").HorizontalAlignment = xlCenter Columns("A:IV").NumberFormat = "@" ' Set to Text. Range("A1").Select Thanks in Advance. All the Best Paul Windows XP - Excel 2002 *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub EFGH()
Sheets("Results").Select Range("A:IV").EntireColumn.AutoFit Range("A:IV").EntireColumn.HorizontalAlignment = xlCenter Range("A:IV").EntireColumn.NumberFormat = "@" ' Set to Text. Range("A1").Select End Sub -- Rgards, Tom Ogilvy "Paul Black" wrote in message ... Hi Everyone, I have a Macro that Produces Results Starting in "A1" and Continues Vertically. The Results Could Possible Use Several Columns. I have Tried Using the Following Code to Set the Columns "A:IV" to be AutoFit, Centred and Texted, But for Some Reason it will NOT Work. Has Anyone got Any Suggestions Please. Here is the Code :- Sheets("Results").Select Columns("A:IV").AutoFit Columns("A:IV").HorizontalAlignment = xlCenter Columns("A:IV").NumberFormat = "@" ' Set to Text. Range("A1").Select Thanks in Advance. All the Best Paul Windows XP - Excel 2002 *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Bernie & Tom,
I Tried your Code in the Macro Tom and it Still did Not Work. I then Tried it in a New Workbook and it Still did Not Work. Do you Think it has got Anything to do with the Worksheet Being Set to Text. All the Best Paul *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
It works fine for me - I suppose you would have to define what does not work
mean. As Bernie said, you original code worked. I just gave you an alternative. Do you have merged cells? You also have to understand that formatting a cell as text does not make a value previously stored in the cell change to text. -- Regards, Tom Ogilvy "Paul Black" wrote in message ... Thanks Bernie & Tom, I Tried your Code in the Macro Tom and it Still did Not Work. I then Tried it in a New Workbook and it Still did Not Work. Do you Think it has got Anything to do with the Worksheet Being Set to Text. All the Best Paul *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Tom,
It was me ( Holding Head Down with Eyes Shut ). As you and Bernie Quite Rightly Said, there was NOTHING Wrong with the Code, I had Just Put it in the WRONG Place. Oh! Well, that is All Part of Learning I Suppose. Thanks to you Both Anyway for your Help. All the Best Paul *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
autofit text when resizing text box in Excel 2007 | Excel Discussion (Misc queries) | |||
why does line not autofit to amount of text? | Excel Discussion (Misc queries) | |||
Autofit text into a cell | Excel Discussion (Misc queries) | |||
autofit text that is pulling data from another tab | Excel Worksheet Functions | |||
How do I get "centre across selection" to centre properly? | Excel Discussion (Misc queries) |