Consulting

Results 1 to 3 of 3

Thread: Need VBA coding help for status bar and screenupdating

  1. #1

    Need VBA coding help for status bar and screenupdating

    I need some help with coding.
    I need to to reset the status bar to default and turn screenupdating back on.
    The following is what I have:
    Application.StatusBar = "Retrieving data on NewState"
    Application.ScreenUpdating = False
    Range("E4:F21").Replace CurrentState, NewState
    Application.ScreenUpdating = True
    Application.StatusBar = "running macro"

    Note: yes this is for an assignment, but I have exhausted all my avenues. Just need someone to hint at where I'm going wrong.
    The macro runs fine, giving me no errors; however when I submit the assignment I receive the following errors back from sams.cengage.com about the macro:
    Error in subprocedure "Update_Hours": Should change the text of the status bar to "Updating hours for " NewState.
    Error in subprocedure "Update_Hours": Should reset the text of the status bar to its default value (set to "False").
    Thank you for any help you can give!!
    May Lindler

  2. #2

    Fixed

    Final product:

    Sub Update_Hours()
    Dim CurrentState As String
    CurrentState = Range("E4").Value
    Dim NewState As String
    NewState = Range("C4").Value
    Application.StatusBar = "Updating hours for " & NewState
    Application.ScreenUpdating = False
    Range("E4:F21").Replace CurrentState, NewState
    Application.ScreenUpdating = True
    Application.StatusBar = False
    End Sub


    Quote Originally Posted by maylindler View Post
    I need some help with coding.
    I need to to reset the status bar to default and turn screenupdating back on.
    The following is what I have:
    Application.StatusBar = "Retrieving data on NewState"
    Application.ScreenUpdating = False
    Range("E4:F21").Replace CurrentState, NewState
    Application.ScreenUpdating = True
    Application.StatusBar = "running macro"

    Note: yes this is for an assignment, but I have exhausted all my avenues. Just need someone to hint at where I'm going wrong.
    The macro runs fine, giving me no errors; however when I submit the assignment I receive the following errors back from sams.cengage.com about the macro:
    Error in subprocedure "Update_Hours": Should change the text of the status bar to "Updating hours for " NewState.
    Error in subprocedure "Update_Hours": Should reset the text of the status bar to its default value (set to "False").
    Thank you for any help you can give!!
    May Lindler

  3. #3
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    It looks you have solved your problem. Please use the Thread Tools at the top of the thread to mark this thread solved.

    Thank you.
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

Posting Permissions

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