+ Reply to Thread
Results 1 to 3 of 3

Defining Worksheet Function as variable

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    09-25-2012
    Location
    Ventura, united States
    MS-Off Ver
    Excel 2010
    Posts
    346

    Defining Worksheet Function as variable

    Can anyone help me define a variable as a worksheet function? It's been a while and I forget the syntax. This is along the lines but with incorrect syntax on the Random_Number variable

    Sub I_Dont_Know_How()
    
    dim Random_Number as Long
    dim Rowsend as Long
    
    rowsend = range("A" & rows.count).end(xlup).row
    Random_Number = worksheetfunction(Randnumber(1, rowsend))
    
    cells(1,Random_Number).select
    
    End Sub

  2. #2
    Valued Forum Contributor xlbiznes's Avatar
    Join Date
    02-22-2013
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    1,223

    Re: Defining Worksheet Function as variable

    try this,

    Random_Number = Application.WorksheetFunction.RandBetween(1, rowsend)
    Happy Computing ,

    Xlbiznes.

    To show your appreciation please click *

  3. #3
    Forum Contributor
    Join Date
    09-25-2012
    Location
    Ventura, united States
    MS-Off Ver
    Excel 2010
    Posts
    346

    Re: Defining Worksheet Function as variable

    I love this forum! Problem solved-

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Defining textbox value as a variable
    By roarwali in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-18-2013, 09:13 AM
  2. Defining a variable as Vlookup
    By Jiptastic in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-08-2013, 07:13 PM
  3. Defining a cell name as a variable
    By michaelbails in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-28-2010, 02:45 PM
  4. Defining a Variable Range
    By Grayb in forum Excel General
    Replies: 1
    Last Post: 01-01-2010, 05:48 AM
  5. [SOLVED] Defining a Variable
    By Phil H in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-22-2006, 07:10 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1