View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jim08 Jim08 is offline
external usenet poster
 
Posts: 1
Default This clever code ain't doing nothin, why?

I have a spreadsheet that has the account number in the first collum of the
parent row followed by some children rows that have no account number. I want
to load the spreadsheet into an access database and normalize it but I need
to load the account number into the children rows. So I tried the code below,
it however does nothing. Any help is apprecaited
Thanks
Jim
'
' Plug account number into mailbox records
'
Public Sub plugAccountNumber()

Dim accountNumber As Long
Dim startRow As Long
Dim endRow As Long
Dim rowNdx As Long

Application.ScreenUpdating = False
On Error GoTo EndMacro:

' Just doing 50 as a test

startRow = 1
endRow = 50

For rowNdx = startRow To endRow

If Me.Cells(rowNdx, 1).Value < "" Then
accountNumber = Me.Cells(rowIndex, 1).Value
Else
Me.Cells(rowIndex, 1).Value = accountNumber
End If

Next rowNdx

EndMacro:
On Error GoTo 0
Application.ScreenUpdating = True

End Sub