473,387 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

[Excel/VBA]: How to resolve -2147467259 error while populating combobox?

Hi,

I have imported huge log file (35 MB size) into a worksheet. One of its column contain some data.

There is a Main Sheet which contains "ComboBoxStartTime" ActiveX Combo control.

I am populating data from a range into this combobox. The number of rows containing data are huge because of size of file (let say: 506390 or more) However i am getting an error:

Run-time error '-2147467259 (80004005)

The code for populating combobox is:

Expand|Select|Wrap|Line Numbers
  1. Public Sub FillStartTimeComboBox(Datasheet As Worksheet, ByVal FirstDataRow As Long)
  2.  
  3. Application.ScreenUpdating = False
  4.     Dim myRange As Range
  5.     Dim r As Range
  6.     Dim LastDataRow As Long
  7.     Dim LValue As String
  8.  
  9.     'Sheet1.ComboBoxStartTime.Clear
  10.     Datasheet.Activate
  11.     LastDataRow = Cells(1000000, 1).End(xlUp).row
  12.     'Set the range of cells, whose values will be put into the combobox
  13.     Set myRange = Range(Cells(FirstDataRow, 1), Cells(LastDataRow, 1))
  14.  
  15.     'work through each cell in the range and put the value in the Spectrum combobox.
  16.     Cells(FirstDataRow, 1).Select
  17.         For Each r In myRange
  18.             'add cell value to combobox list if it is not a blank cell.
  19.             If r.Value <> "" Then
  20.                 LValue = Format(r, "dd/mm/yyyy hh:mm:ss")
  21.                 Sheet1.ComboBoxStartTime.AddItem LValue
  22.             End If
  23.         Next r
  24.  Application.ScreenUpdating = True
  25. End Sub
  26.  

Error is coming at line:
Expand|Select|Wrap|Line Numbers
  1. Sheet1.ComboBoxStartTime.AddItem LValue
Any help would be highly appreciated

Thanks
Prashant Dixit
Oct 1 '10 #1
4 7028
MMcCarthy
14,534 Expert Mod 8TB
Put a code breakpoint on this line and try to figure out if the code runs through and falls over only at a certain value or if it never runs at all. Also, check out that LValue looks OK.

Also, when this error occurs there is usually something written after it to clarify the error.
Oct 1 '10 #2
I have done it and its giving error at Row ID: 121100 whereas file contain around 5000000

All data upto row id 121099 is populating in combobox but not afterwards

And the Error message says
Runtime Error: '-2147467259 (80004005)
Unspecified Error.

It is problem with the system resource or with huge amount of data?

Thanks
Prashant
Oct 1 '10 #3
MMcCarthy
14,534 Expert Mod 8TB
Check out what value is stored in LValue when the code breaks. You should be able to do this by hovering over the LValue part of line #20. The reason I am asking is because the value you are looking at is a timestamp and if for some reason it doesn't recognise it as a valid date it may fall over.

It's also possible that you are just limited on the number of values you can store in a combobox. Excel has a number of limitations. One of those is that you can't visibly see more than ~65,500 records. It's possible that excel can't store more than 121,099. I find it suspicious that the number seems to be double the visible capacity.

In all honesty I've never tried dealing with anywhere near this number of records in Excel. It's not really designed to handle it.
Oct 4 '10 #4
NeoPa
32,556 Expert Mod 16PB
Prashant, You can't fill a ComboBox with that many entries. It makes no sense as it becomes totally unusable the more you have and even 50 entries makes it almost useless.

I doubt the control was ever designed to stretch as far as you're trying to take it.
Oct 28 '11 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

17
by: Ange T | last post by:
Hi there, I'm having pain with the VB behind an Access form. The form is used to create reports in Excel based on the details entered in the form. This has always worked without error on my...
1
by: chris_j_adams | last post by:
Hi, I'm trying to use Excel VBA ('97) to send details from an Excel sheet to a web page. I'm having some success but I've one issue that's proved difficult to find in the archives. There are...
5
by: Joper | last post by:
Hi, I'm getting the ORA-00911:invalid character when trying to do a query to a Oracle database from a Excel VBA Macro. I'm using the following code extraction: ----BEGIN CODE----- Sub...
1
by: Paul | last post by:
Dear all, I am trying to create a DLL in C# and try to invoke the DLL from my excel VBA code. This may not be a purely C# problem, since I am not sure whether I have done something wrong with...
2
by: prakashsakthivel | last post by:
What I want to know is that while one excel application is closed by VBA code from module, another excel application has to be opened. That means, I have written code to open new excel sheet in the...
76
by: JFKJr | last post by:
Hi, the following Excel VBA code is used to select 5 rows by double clicking the cell in the first column corresponding to that row. The code is working fine in excel. But, I need Access VBA code,...
17
by: Blaine | last post by:
I've created the following dll in vb 2008. ___________________________________________________________ Public Interface IDemo Sub doSomething() End Interface Public Class implementIDemo...
0
by: Art Altman | last post by:
I have found a workaround to the Excel VBA “ run time error 40036 application-defined or object error”. It does not fix the original problem, which is in excel, SOMEWHERE. A few responses I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.