View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_3_] Dave Peterson[_3_] is offline
external usenet poster
 
Posts: 2,824
Default ListBox Question

I've got two guesses.

One there's nothing in listbox2. (not a good guess, huh?)

My second one is this:
you have an "On error resume next" line in your code.
Your formula is invalid. The error occurs and the resume next takes over.

When I'm dropping a formula into a cell, sometimes I make it text, then go back
to the worksheet and see what's invalid:

Cells(NextRow, 2) = "'" & ListBox2.Text

In fact, I like to be more explicit:

Cells(NextRow, 2).value = "'" & ListBox2.Text
or
Cells(NextRow, 2).formula = "'" & ListBox2.Text

Excel is pretty forgiving, but I find that it's a good way to document what I'm
doing (without adding more comments).


"Randal W. Hozeski" wrote:

I am using the following code to display results of a userform,
but for some reason the ListBox2 does not populate my sheet.
ListBox1 and TextBox1 come thru fine. The only difference
between the range in ListBox1 and ListBox2, is that ListBox1
has text and ListBox2 has a formula in it (Date)
field. Any idea why/suggestions?

NextRow = _
Application.WorksheetFunction.CountA(Range("A:A")) + 1
Cells(NextRow, 1) = ListBox1.Text
Cells(NextRow, 2) = ListBox2.Text (tried .Value too)
Cells(NextRow, 3) = TextBox1.Text

Also ListBox1 has 4 columns in it and it returns the value that
is in the first column. What if I want the value of Column 1 in
the result page first cell and the value of column 3 in another?

Thanks -Randy-

Thanks -Randy-


--

Dave Peterson