Closed Thread
Results 1 to 2 of 2

Running Macros

  1. #1
    Registered User
    Join Date
    03-23-2012
    Location
    Australia
    MS-Off Ver
    Professional Plus 2010
    Posts
    51

    Running Macros

    Hi,

    I'm very new at this and need some help.

    I've found an example of macro code online and am trying to get it to run.

    Here's the code:

    'Subroutine store values in Column A of the active Worksheet
    ' into an array

    Sub GetCellValues()

    Dim iRow As Integer ' stores the current row number
    Dim dCellValues() As Double ' array to store the cell values

    iRow = 1
    ReDim dCellValues(1 To 10)

    ' Do Until loop to extract the value of each cell in column A
    ' of the active Worksheet, as long as the cell is not blank

    Do Until IsEmpty(Cells(iRow, 1))

    ' Check that the dCellValues array is big enough
    ' If not, use ReDim to increase the size of the array by 10
    If UBound(dCellValues) < iRow Then
    ReDim Preserve dCellValues(1 To iRow + 9)
    End If

    ' Store the current cell in the CellValues array
    dCellValues(iRow) = Cells(iRow, 1).Value

    iRow = iRow + 1
    Loop

    End Sub I've put this code into Microsoft Visual Basic.
    In sheet 1 I've typed numbers in column A as follows:

    1
    2
    3

    What do I do now? Do I need to type something in the function bar? How do I run the macro?

    Thanks

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Running Macros

    Welcome to the Forum, unfortunately:

    This is a duplicate post and as such does not comply with Rule 5 of our forum rules. This thread will now be closed, you may continue in your other thread.

    Thread Closed.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

Closed Thread

Thread Information

Users Browsing this Thread

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

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