Results 1 to 26 of 26

Re: Compile error: Sub or Function not defined

Threaded View

  1. #1
    Registered User
    Join Date
    07-09-2014
    Location
    HOUSTON
    MS-Off Ver
    2010
    Posts
    22

    Re: Compile error: Sub or Function not defined

    Group: Have two worksheets in same workbook. First worksheet is "ReArrangedAddr" Which basically has a command button to click to run a "Sub" behind the second worksheet "Orig SH Register". When I click on button on first worksheet, I get error "Compile Error: Sub or Function not defined"
    * * * * * code behind command button * * * * *

    Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #3 requires code tags. I have added them for you this time because you are a new member. --6StringJazzer

             Public Sub ReArrangeButton_Click()  ----        this line is in yellow after trying to run
    
             Call RearrangeAddresses             ----             this line is in blue
    
             Application.Run
    
             End Sub
    * * * * * * *
    Code for Sub attempting to be called by command button

              '   For __________                         , 140708, Rearrange address elements in shareholder register
    
    Public iRow As Integer
    Public jColumn As Integer
    
    Sub RearrangeAddresses()
        Option Explicit
        Dim i As Integer, StartRow As Integer
        Dim LastAddrElement As Integer
        
    StartRow = ReArrangedAddr!(B4)
    i = StartRow
    LastAddrElement = Cells(Rows.Count, 1).End(xlUp).Row
    iRow = ReArrangedAddr!(B6)
    jColumn = 1
    
    Do Until i > LastAddrElement
        If IsEmpty(Cells(i, 1)) Then
            i = i + 1
        Else: ReArrangedAddr!(iRow, jColumn) = Cell(i, 1)
            i = i + 1
            jColumn = jColumn + 1
            ReArrangedAddr!(iRow, jColumn) = Cell(i, 1)
        End If
    Just learning VBA from books and searches on 'net. Can anyone tell what I am doing wrong or missing ?? Many thanks in advance

    fairweather
    Last edited by 6StringJazzer; 07-09-2014 at 08:21 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. compile error:Sub or function are not defined
    By baig123 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-06-2014, 08:19 AM
  2. [SOLVED] Compile error: sub or function not defined
    By Anita7 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-17-2012, 08:50 PM
  3. compile error: sub or function not defined
    By eaglefana101 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-17-2012, 01:18 AM
  4. Compile error: Sub or Function not defined
    By Nanga in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-23-2011, 11:05 AM
  5. Compile Error. Sub of Function not Defined.
    By momo123 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 07-16-2009, 05:50 AM

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