View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
STEVE BELL STEVE BELL is offline
external usenet poster
 
Posts: 692
Default Error 91 - Sometimes happens, sometimes it doesnt.

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