Results 1 to 17 of 17

Thread: Excel Macro suddenly starts giving incorrect ActiveCell Data

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #12
    VBAX Mentor
    Joined
    Jan 2008
    Posts
    411
    Location
    I've been asked to provide more of the full Macro rather than just the offending portion.
    Here's more or less the full bit to get an idea of what it does.


    After trying all of the suggestions, I'm noticing another issue.
    Now, if I've selected a cell, the next time the Macro runs, it will select the previous cell as the activecell even if I've selected a different cell.
    This was NOT an issue before.


    Here's the code.


    Sub CellPost() 
        Dim myRow As Long
        Dim val As String
        Dim activeRow As Long    
        val = ActiveCell.Value
        myRow = ActiveCell.Row        
        Sheets("Gunsmoke").Activate
        Sheets("Gunsmoke").Select    
        activeRow = ActiveCell.Row
        Cells(activeRow, 1).Select    
        If ActiveCell.Column <> 1 Then
            MsgBox " Select a Lot Number from Column A "
            Exit Sub
        Else
            If ActiveCell.Interior.Color = vbYellow Then
                MsgBox " This Lot was already Invoiced"
                Exit Sub
            Else
                Sheets("Parts&Labor").Unprotect
                Sheets("Parts&Labor").Range("A18:E22").Locked = False
                Sheets("Parts&Labor").Range("E3").Value = Now()
                ' MORE POSTING IS DONE HERE
                ActiveCell.Interior.Color = vbYellow
                ActiveCell.Offset(0, 8).Value = Now()
                ' MORE POSTING IS DONE HERE
            End If
        End If
    End Sub
    Last edited by Aussiebear; Today at 03:11 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •