Hi All,
I'm trying to subtract the value of a textbox in a userform from a value in a cell, and display this new value in another textbox. An added complexity is this takes place in Visio but communicates to excel to find certain values. I have the following code:
Dim xlapp As Object
Dim XLWB As excel.Workbook
Set xlapp = GetObject(, "Excel.Application")
With xlapp
.Windows("Spreadsheet.xlsm").Activate
.Run "'Spreadsheet.xlsm'!UpdateAll"
Set XLWB = .ActiveWorkbook
TextBox1.Text = XLWB.Worksheets("Sheet1").Range("G14").Text
End With
which displays the value of a cell in excel, in a textbox in a visio userform. The excel cell value then changes and I thought that it would work if I were to duplicate this code and run a new sub changing the last line to:
TextBox5.Text = XLWB.Worksheets("Sheet1").Range("G14").Value - CInt(TextBox1.Text)
But I get a type mismatch error on the line. Can anyone help?
Bookmarks