Consulting

Results 1 to 3 of 3

Thread: Solved: Prevent useform from pulling data from other open workbooks.

  1. #1

    Solved: Prevent useform from pulling data from other open workbooks.

    Hi,

    Ive made a major noob oversight

    please could someone advise me how to prevent my useform form pulling data from other open workbooks. ive set the useform workbook to xlminimized, so i expect that this is allowing this to happen, but, i need the xlminimized to stay really.

    how would i change this example to prevent my issue

    [VBA]Private Sub SpinCalls_Spinup()
    Application.ScreenUpdating = False
    Sheets("Sheet1").Range("C8").Value = Sheets("Sheet1").Range("C8").Value + 1
    LblCalls.Caption = Sheets("sheet1").Range("C8").Value
    LblBox1.Caption = Sheets("sheet1").Range("D10").Text
    LblBox2.Caption = Sheets("sheet1").Range("E10").Text
    LblBox3.Caption = Sheets("sheet1").Range("F10").Text
    LblAcwDay.Caption = Sheets("sheet1").Range("G10").Text
    Update
    End Sub
    Private Sub SpinCalls_Spindown()
    Application.ScreenUpdating = False
    Sheets("Sheet1").Range("C8").Value = Sheets("Sheet1").Range("C8").Value - 1
    LblCalls.Caption = Sheets("sheet1").Range("C8").Value
    LblBox1.Caption = Sheets("sheet1").Range("D10").Text
    LblBox2.Caption = Sheets("sheet1").Range("E10").Text
    LblBox3.Caption = Sheets("sheet1").Range("F10").Text
    LblAcwDay.Caption = Sheets("sheet1").Range("G10").Text
    Update
    End Sub[/VBA]

  2. #2
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,902
    Location
    If you don't specify the workbook, you are specifying the activeworkbook. Use ThisWorkbook if that is what you intend.

    [VBA]
    Private Sub SpinCalls_Spinup()
    Application.ScreenUpdating = False
    With ThisWorkbook.Sheets("Sheet1")
    .Range("C8").Value = .Range("C8").Value + 1
    LblCalls.Caption = .Range("C8").Value
    LblBox1.Caption = .Range("D10").Text
    LblBox2.Caption = .Range("E10").Text
    LblBox3.Caption = .Range("F10").Text
    LblAcwDay.Caption = .Range("G10").Text
    End With
    Update
    End Sub
    Private Sub SpinCalls_Spindown()
    Application.ScreenUpdating = False
    With ThisWorkbook.Sheets("Sheet1")
    .Range("C8").Value = .Range("C8").Value - 1
    LblCalls.Caption = .Range("C8").Value
    LblBox1.Caption = .Range("D10").Text
    LblBox2.Caption = .Range("E10").Text
    LblBox3.Caption = .Range("F10").Text
    LblAcwDay.Caption = .Range("G10").Text
    End With
    Update
    End Sub[/VBA]

  3. #3
    Thank you Kenneth,

    Really sorry for the late response. This is the first chance ive had to get on here for a few day.

    As always, you nailed it.

Posting Permissions

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