Search : in
By :

Runtime error 91 and 2147417851 (80010105)

Last answer on Nov 6, 2009 12:40:16 am GMT HS55, on Nov 4, 2009 8:17:59 pm GMT 
 Report this message to moderators

Hello,


I get an error in the following line (at times):

rowTotal = ActiveSheet.UsedRange.Rows.count --> run-time error 91 Object variable or with block variable not set.

Also, I am creating a bar graph based on data in on of the sheets in my Excel Workbook.
When I first run the script, the graph has one bar and the x and y axis data are reversed. When I re-run it, it graphs correctly. I'm not quite sure why this is occuring.

With oChart
.ChartType = xlColumnClustered
.HasTitle = True
.SetSourceData Source:=Sheets("Sheet2").Range("B1:B148"), PlotBy:= _
xlColumns 'data source
.SeriesCollection(1).XValues = Sheets("Sheet2").Range("A1:A148") 'naming the x-axis
.ChartTitle.Characters.Text = "QTP License Usage 2009"
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Date (2009)" 'x axis title
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Number of Users" 'y axis title
With .Parent 'location of Top and Left of chart
.Top = Range("F9").Top
.Left = Range("F9").Left
.Name = "Chart1"
End With
End With

-VBA to create a graph in excel.
Thanks in advance.

Configuration: Windows XP Professional 
Internet Explorer 7.0

Best answers for « runtime error 91 and 2147417851 (80010105) » in :
Error Management under Pascal Show Error Management under Pascal Under Pascal, the compiler is set as default for managing errors. This is why the program stops by displaying a message Runtime error followed error number. However if the programmer wishes to set the...
[Pascal]Errors Handling Show[Pascal] Errors Handling By default, in Pascal, error handling is provided by the compiler. For this reason, the program ends by displaying a message starting with Runtime error followed by error number ... So if the programmer...
Error Codes in Windows ShowError Codes in Windows The list below details the error codes displayed in the dialog boxes in Windows: Code Description _________________________________________________________________________ 1 Incorrect function....
Windows Error Codes and How to Fix them ShowWindows Error Codes and How to Fix them Below is a list of the most common error codes that you an face while using Windows and its basic components. Some solutions have been provided for you to try to solve them. You should also note that...
Error checking ShowError checking Binary encoding is very practical for use in electronic devices such as computers, in which information can be encoded based on whether an electrical signal is present or not. However, this electrical signal may suffer disturbances...

1

venkat1926, on Nov 5, 2009 11:09:25 am GMT

Regarding first question what is dimension of rawstotal
it should be
dim rowstotal as long

not as range

check this.

Reply to venkat1926

3

HS55, on Nov 5, 2009 3:40:32 pm GMT

RowTotal is an integer. I'm just trying to figure out the number of rows of data in the sheet.
I changed it to Long, but I still have the same problem. When I run it once, it works...when I run it again, it gives run-time error 91.

Same thing with the 2nd problem - I get the error, then when I stop the macro and re-run, it works.

Reply to HS55

4

 venkat1926, on Nov 6, 2009 12:40:16 am GMT

I wonder whether it is possible for you to post the first part of the code relevant to the first question

Reply to venkat1926