ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Random error 91 (https://www.excelbanter.com/excel-programming/331803-random-error-91-a.html)

BerkshireGuy[_2_]

Random error 91
 
I sometimes get an error 91 with this code, but sometimes it works.

objWkb.Worksheets("Sorted Rankings").Range ("A1:B1")
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = True
End With

Any ideas?

Thanks


BerkshireGuy[_2_]

Random error 91
 
objWkb.Worksheets("Sorted Rankings").Range ("A1:B1") .Select

That is the line. Still having the error 91.

-Brian


Chip Pearson

Random error 91
 
It sounds like you haven't initialized the objWkb variable.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"BerkshireGuy" wrote in message
oups.com...
objWkb.Worksheets("Sorted Rankings").Range ("A1:B1") .Select

That is the line. Still having the error 91.

-Brian





All times are GMT +1. The time now is 07:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com