Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2002
    Location
    NJ
    Posts
    139

    Unanswered: Hiding Excecution From User

    HI,

    win xp
    excel 2k

    Is there a way to run this code from sheet1 without seeing anything happening? the changes is long. In another word, I don't want the user to see what takes place in sheet1.

    Code:
    Private Sub CommandButton1_Click()
        sheet2.activate
        Dim FNAME, LNAME As String
        FNAME = InputBox("OLD NAME? :", "Name to change", "THERESA")
        LNAME = InputBox("NEW NAME? :", "Name to change", "PAMELA")
        Dim MyCells As Range
            
            For Each MyCells In Range("A1:BX356")
                    'MyCells.Select
                    If MyCells = FNAME Then
                    MyCells.Value = LNAME
                End If
            Next
    sheet1.activate
    End Sub

  2. #2
    Join Date
    Feb 2003
    Location
    Wichita,KS
    Posts
    44
    Turn off the screen updating as follows.
    Code:
    Private Sub CommandButton1_Click()
        sheet2.activate
        Dim FNAME, LNAME As String
        FNAME = InputBox("OLD NAME? :", "Name to change", "THERESA")
        LNAME = InputBox("NEW NAME? :", "Name to change", "PAMELA")
        Dim MyCells As Range
            
    Application.ScreenUpdating = False
            For Each MyCells In Range("A1:BX356")
                    'MyCells.Select
                    If MyCells = FNAME Then
                    MyCells.Value = LNAME
                End If
            Next
    sheet1.activate
    Application.ScreenUpdating = True
    End Sub

  3. #3
    Join Date
    Oct 2003
    Posts
    1,091
    Add the line asfter Dim statements:
    Code:
    Application.ScreenUpdating = False
    Then after sheet1.Activate add this line:

    Code:
    Application.ScreenUpdating = True
    old, slow, and confused
    but at least I'm inconsistent!

    Rich
    (retired Excel 2003 user, 3/28/2008)

    How to ask a question on forums

  4. #4
    Join Date
    Oct 2003
    Posts
    1,091
    Ray, you are too fast for my old hands! LOL
    old, slow, and confused
    but at least I'm inconsistent!

    Rich
    (retired Excel 2003 user, 3/28/2008)

    How to ask a question on forums

Posting Permissions

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