Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Ok, sounds like an Almond Joy commerical.
Anyways, I have the following code and sometimes I get an error 91 and sometimes I dont. Any ideas? objWkb.Worksheets("Sorted Rankings").Range("A1:B1").Select With Selection .HorizontalAlignment = xlCenter .VerticalAlignment = xlBottom .WrapText = False .Orientation = 0 .AddIndent = False .ShrinkToFit = False .MergeCells = True End With |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can make this easier:
======================================= With Worksheets("Sorted Rankings").Range("A1:B1") .HorizontalAlignment = xlCenter .VerticalAlignment = xlBottom .WrapText = False .Orientation = 0 .AddIndent = False .ShrinkToFit = False .MergeCells = True End With =========================== And you may not need the lines = False I'm not sure what error91 is. But your code will fail if the worksheet is not the active sheet. The above code doesn't care. It also works faster by not selecting anything. -- steveB Remove "AYN" from email to respond "BerkshireGuy" wrote in message oups.com... Ok, sounds like an Almond Joy commerical. Anyways, I have the following code and sometimes I get an error 91 and sometimes I dont. Any ideas? objWkb.Worksheets("Sorted Rankings").Range("A1:B1").Select With Selection .HorizontalAlignment = xlCenter .VerticalAlignment = xlBottom .WrapText = False .Orientation = 0 .AddIndent = False .ShrinkToFit = False .MergeCells = True End With |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Steve,
Ok, I modified as suggested now I am getting Method Worksheet of Global failed. Thanks Brian |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hello BerkshireGuy, Error 91 - "Object variable or With Block variable not set." The With Block looks fine. I suspect somewherelse in your code objWkb is not being set. Sincerely, Leith Ross -- Leith Ross ------------------------------------------------------------------------ Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465 View this thread: http://www.excelforum.com/showthread...hreadid=379162 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
My bad....
Change Worksheets(.....) to Sheets(....) -- steveB Remove "AYN" from email to respond "BerkshireGuy" wrote in message ups.com... Steve, Ok, I modified as suggested now I am getting Method Worksheet of Global failed. Thanks Brian |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
With objWkb.Worksheets("Sorted Rankings").Range("A1:B1")
.HorizontalAlignment = xlCenter .VerticalAlignment = xlBottom .WrapText = False .Orientation = 0 .AddIndent = False .ShrinkToFit = False .MergeCells = True End With -- Regards, Tom Ogilvy "BerkshireGuy" wrote in message oups.com... Ok, sounds like an Almond Joy commerical. Anyways, I have the following code and sometimes I get an error 91 and sometimes I dont. Any ideas? objWkb.Worksheets("Sorted Rankings").Range("A1:B1").Select With Selection .HorizontalAlignment = xlCenter .VerticalAlignment = xlBottom .WrapText = False .Orientation = 0 .AddIndent = False .ShrinkToFit = False .MergeCells = True End With |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Why doesnt this work? | Excel Worksheet Functions | |||
Why doesnt this work | New Users to Excel | |||
I want to correct a #div/0! error but the IF function doesnt work | Excel Worksheet Functions | |||
TAB Key doesnt work. | Excel Programming |