VBA: I want to auto fill a combo box with the results of calculations found in all the column's rows that have content.

Ameri9595

New Member
Joined
Aug 10, 2020
Messages
1
Office Version
  1. 365
Platform
  1. Windows
So I have my excel sheet automatically increments serial numbers 1, 2, 3.. to infinity based on the number of rows used.
This was obtained by the following command:
=IF(B3="","",MAX($A$1:A2)+1)
So anyhow I now need to introduce a combo box that can look at these numbers and show them all.
I used the following command:
VBA Code:
Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("Sheet1")
Dim i As Integer
Me.ComboBox1.Clear
For i = 3 To sh.Range("A" & Application.Rows.Count).End(xlUp).Row
Me.ComboBox1.AddItem sh.Range("A" & i).Value
Next i
but it doesn't work, it only works with mere characters and not numbers obtained from calculations.. So even though the cell is showing numbers, it can't read them.
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Hi & welcome to MrExcel.
There is nothing wrong with your code & it will happily add the numbers from A3 down into the combo.
Is the combo on a userform or a sheet?
Also where is the code & how is it being called?
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,552
Members
449,088
Latest member
davidcom

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top