PDA

View Full Version : Solved: Prevent useform from pulling data from other open workbooks.



gringo287
11-08-2012, 05:05 AM
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:help

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

Kenneth Hobs
11-08-2012, 07:31 AM
If you don't specify the workbook, you are specifying the activeworkbook. Use ThisWorkbook if that is what you intend.


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

gringo287
11-12-2012, 04:34 PM
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.