Results 1 to 2 of 2

Code doesn't update from a cell?

Threaded View

  1. #1
    Valued Forum Contributor Macdave_19's Avatar
    Join Date
    03-14-2007
    Location
    Birmingham, England
    MS-Off Ver
    12.0
    Posts
    808

    Code doesn't update from a cell?

    Hi guys,

    i have this code:

    Sub Start()
    On Error GoTo ERRORHANDLER
            
    ActiveWorkbook.Save
    
    Dim SProd As String
    Dim SFreq As String
    Dim SAccAge As String
    
    SProd = Sheets("Cover").Range("B1").Value
    SFreq = Sheets("Cover").Range("J7").Value
    SAccAge = Sheets("Cover").Range("M7").Value
    
    Sheets("Clean").Activate
    
    If SAccAge = "Oldest" Then
    Range("AU1").Select
        Range("A1:CX25000").Sort Key1:=Range("AU1"), Order1:=xlDescending, Header:= _
            xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
            DataOption1:=xlSortNormal
    ElseIf SAccAge = "Newest" Then
    Range("AU1").Select
        Range("A1:CX25000").Sort Key1:=Range("AU1"), Order1:=xlAscending, Header:= _
            xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
            DataOption1:=xlSortNormal
    End If
    
        Range("E2").Select
    RESTART:
         Do Until ActiveCell.Offset(0, 8).Value = SProd And ActiveCell.Offset(0, 29).Value = SFreq
              ActiveCell.Offset(1, 0).Select
         Loop
              If ActiveCell.Offset(0, 97).Value <> "" Then
                 ActiveCell.Offset(1, 0).Select
                 GoTo RESTART
              End If
        ActiveCell.Offset(0, 97).Value = "Worked"
        
        Worksheets("Cover").Range("A4").Value = ActiveCell.Value
        Worksheets("Cover").Range("A6").Value = ActiveCell.Offset(0, 3).Value   ' Bill Status
        Worksheets("Cover").Range("A8").Value = ActiveCell.Offset(0, 1).Value   ' New Flag
        Worksheets("Cover").Range("A10").Value = ActiveCell.Offset(0, 66).Value ' Port Rec
        Worksheets("Cover").Range("A12").Value = ActiveCell.Offset(0, 79).Value ' Unbilled Value
        Worksheets("Cover").Range("A14").Value = ActiveCell.Offset(0, 21).Value ' Company Name
        Worksheets("Cover").Range("A16").Value = ActiveCell.Offset(0, 67).Value ' Unbilled Reason
       
        
        Worksheets("Cover").Activate
        ActiveWorkbook.Save
        FrmAcc.Show
        Exit Sub
    
    ERRORHANDLER:
        MsgBox ("Please wait a few moments and try again, a colleague is accessing account data"), vbInformation
            Exit Sub
    End Sub
    Now when i change range G7 from E to G the code still pics up an account that has a G? i have to then exit and press "get account" again to get the desired results?

    i figure this is like a refresh problem? any ideas?

    Cheers for reading my thread!!
    Last edited by VBA Noob; 09-28-2007 at 09:56 AM.
    Mr MaGoo
    Magoo.Inc MMVII

    If i've helped please add to my Rep by Clicking on the Blue Scales in the top right hand corner of the post

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