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
Bookmarks