ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,806
- Office Version
- 2007
- Platform
- Windows
Hi,
Code in use is shown below.
I am trying to place the value into my worksheet at A34 BUT the valueskeeps going to cell E1
Code in use is shown below.
I am trying to place the value into my worksheet at A34 BUT the valueskeeps going to cell E1
VBA Code:
Private Sub TransferButton_Click()
Dim i As Integer
Dim ControlsArr As Variant, ctrl As Variant
Dim x As Long
For i = 1 To 2
With Me.Controls("ComboBox" & i)
If .ListIndex = -1 Then
MsgBox "MUST SELECT ALL OPTIONS", vbCritical, "MONTH,YEAR & MILEAGE TRANSFER MESSAGE"
.SetFocus
Exit Sub
End If
End With
Next i
ControlsArr = Array(Me.ComboBox1, Me.ComboBox2, Me.TextBox1)
With ThisWorkbook.Worksheets("MILEAGE")
For i = 0 To UBound(ControlsArr)
Select Case i
Case 1, 2, 4
.Cells(1, i + 3) = IIf(IsNumeric(ControlsArr(i)), Val(ControlsArr(i)), ControlsArr(i))
Case Else
.Cells(1, i + 2) = ControlsArr(i)
ControlsArr(i).Text = ""
End Select
Next i
End With
[COLOR=rgb(184, 49, 47)]TextBox1.Value = Worksheets("MILEAGE").Cells("34,1")[/COLOR]
ActiveWorkbook.Save
Application.ScreenUpdating = True
MsgBox "Month,Year & Mileage Have Been Updated", vbInformation, "SUCCESSFUL MILEAGE MESSAGE"
Unload MYFMILEAGE
End Sub