VBA Variable Question

Kerry McKeon

New Member
Joined
Jan 23, 2014
Messages
6
I just purchased a book, several days ago, on Excel 2010 by Matthew McDonald . I'm trying to teach myself Excel using this book. Have never taken a Excel class before. Just missed registration on 15th January.

I'm trying to create a variable using "Dim As Integer" with the results of "=Randbetween()" Function. I'm doing something wrong. Hate to ask such a simple question, but have no one else to ask.

Thanks,
Kerry
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Re: Kerry

Code:
    Dim i As Long
    
    i = WorksheetFunction.RandBetween(1, 10)
 
Upvote 0
Re: Kerry

Welcome to MrExcel

Code:
Sub test()


    Dim i As Integer
    
    i = WorksheetFunction.RandBetween(50, 60)
    
    MsgBox i


End Sub

Can you please use a descriptive topic title? Thanks in advance.
 
Upvote 0
Re: Kerry

Thank you so much for your reply ! ! You saved me a lot more frustration.
In addition to being a novice at Excel, I'm new this forum.
I'll use a proper descriptive title in the future.

Thanks Again
 
Upvote 0

Forum statistics

Threads
1,214,601
Messages
6,120,465
Members
448,965
Latest member
grijken

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