Splitting a integer into 2's

Dtex20

Board Regular
Joined
Jan 29, 2018
Messages
50
Hi guys,

Sorry for the poor title, i had no idea how to name such a simple task :ROFLMAO:

I have a number lets say "10" stored in a variable. I want to split that variable into 2x multiplication table. 2,4,6,8,10. I need to do this via VBA, i will be adding the result to a combobox.

In python i would store that 2,4,6,8,10 in a list and display it. I'm not sure of the equivalent in VBA.

Thanks for any help guys!
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Maybe !!
Code:
[COLOR="Navy"]Sub[/COLOR] MG07Jun03
[COLOR="Navy"]Dim[/COLOR] c [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long,[/COLOR] n [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long[/COLOR]
 c = 10
 [COLOR="Navy"]For[/COLOR] n = 2 To c [COLOR="Navy"]Step[/COLOR] 2
    ComboBox1.AddItem n
 [COLOR="Navy"]Next[/COLOR] n
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0
Maybe !!
Code:
[COLOR=Navy]Sub[/COLOR] MG07Jun03
[COLOR=Navy]Dim[/COLOR] c [COLOR=Navy]As[/COLOR] [COLOR=Navy]Long,[/COLOR] n [COLOR=Navy]As[/COLOR] [COLOR=Navy]Long[/COLOR]
 c = 10
 [COLOR=Navy]For[/COLOR] n = 2 To c [COLOR=Navy]Step[/COLOR] 2
    ComboBox1.AddItem n
 [COLOR=Navy]Next[/COLOR] n
[COLOR=Navy]End[/COLOR] [COLOR=Navy]Sub[/COLOR]
Regards Mick

Thank you so much!

You guys have been such a help while I've been learning VBA
 
Upvote 0

Forum statistics

Threads
1,214,583
Messages
6,120,383
Members
448,956
Latest member
JPav

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