Results 1 to 3 of 3

Macro canīt be fired from another worksheet

Threaded View

  1. #1
    Registered User
    Join Date
    10-29-2010
    Location
    Netherlands
    MS-Off Ver
    Excel 2003
    Posts
    9

    Macro canīt be fired from another worksheet

    Hello,

    I've got the following macro in my workbook, and it works correct if started from the macro dialog box.
    Iīve assigned the macro to a button on another worksheet, but it fails to fire the macro.

    Am I right in assuming the macro needs editing (worksheet defining) in order to be fired from another worksheet?
    I haven't found any reference to this problem on the net.

    Sub Stack()
    Dim iRow, iCol, iTargetRow, iMaxRow As Long
    iMaxRow = 10000
    iTargetRow = 4
    Columns(55).Clear
    For iCol = 39 To 43
    For iRow = 4 To iMaxRow
    If Cells(iRow, iCol) > "" Then
    Cells(iTargetRow, 55) = Cells(iRow, iCol)
    iTargetRow = iTargetRow + 1
    Else: Exit For
    End If
    Next
    Next
    End Sub
    
    'Change iMaxrow = 500 to the actual maximum row for your data.
    
    'Uncomment the If and End If lines to prevent blank cells from being included in the stack.
    'Uncomment the Else line also to skip to the next column when the first blank cell in the current column is encountered.
    'Uncommenting all three lines would allow you to use a very high iMaxRow value without extending the macro run time but could lose data if there could be any "internal" blank cells.
    Vincent
    Last edited by prop-er; 12-29-2011 at 05:15 AM.

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