Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Can anyone help me out with this please, I get the error "statement
invalid outside type block" Sub minNumber() Sheet = UserForm1.TextBox1.Text ' getting values from form. startRow = UserForm1.TextBox2.Text startCol = UserForm1.TextBox7.Text endCol = UserForm1.TextBox11.Text startValRow = UserForm1.TextBox12.Text startValCol = UserForm1.TextBox4.Text endValCol = UserForm1.TextBox13.Text endValRow = UserForm1.TextBox3.Text destCol = UserForm1.TextBox10.Text result(0 To endCol - 1) As Integer ************* thats the problem line, need help ********************** smallest = Cells(startValRow, startValCol).Value For counter = startRow To endRow hold = ThisWorkbook.Sheets("Sheet1").Cells(counter, startCol).Value hold_first = Abs(hold - Cells(startValRow, startValCol).Value) smallest = Cells(startValRow, startValCol).Value For row = startValRow To endValRow For col = startValCol To endValCol temp = Abs(hold - Cells(row, col).Value) If temp <= hold_first Then smallest = Cells(row, col).Value hold_first = temp End If Next col Next row mytype.result(counter - 1) = smallest Next counter For showResult = startRow To endRow Debug.Print result(showResult) ThisWorkbook.Sheets("Sheet1").Cells(showResult + 1, destCol).Value = result(showResult) Next showResult End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Help with VBA Type statement | Excel Programming | |||
Old Format or Invalid Type Library | Excel Programming | |||
HELP:old format or invalid type library | Excel Programming | |||
Why does this fail with an invalid type error | Excel Programming | |||
Need help in excel with "Statement invalid outside Type block. " error | Excel Programming |