I need to get this VBA script running. It works fine in excell, but when i transfer it over to the Zoho spreedsheet it is completely broken, Basically the way it worked in excel is that you would click on a a cell in column L and the macro would enter all information from columns G-J into the activity log and add or subtract the amount of the item from the main inventory form. Right now the marco'ed enter button does not work. it wont transfer the date and it doesnt reckonize the index number that is progressive. So it just put the information into line 3 of inventory activity log. It also changes the input field into a date time field.....
Private Sub fConfirm_Click()
Dim NewRow As Integer
NewRow = Worksheets("main").Range("B3").Value + 1
If Len(MyForm.fName.Value) = 0 Then
MsgBox "The name field can not be left empty!", vbOKOnly, "MeadInKent"
MyForm.fName.SetFocus
Exit Sub
End If
Worksheets("table").Cells(NewRow, 1).Value = MyForm.fName.Value
Worksheets("table").Cells(NewRow, 2).Value = MyForm.fAmount.Value
Worksheets("table").Cells(NewRow, 3).Value = DateValue(MyForm.fDate.Value)
MyForm.Hide
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Dim thisRow As String
Dim thisColumn As String
thisColumn = Target.Column
thisRow = Target.Row
If thisColumn = "12" Then
If thisRow <> False Then
Dim NewRow As Integer
NewRow = Worksheets("Form").Range("N1").Value + 1
If Worksheets("Form").Range("u" + thisRow).Value = 0 Then
MsgBox "There are errors. No data has been added!", vbOKOnly, "-WTG"
Exit Sub
End If
Sum = Val(Worksheets("form").Range("E" + thisRow).Value) + Val(Worksheets("form").Range("G" + thisRow).Value)
Worksheets("Active Inventory").Range("E" + thisRow).Value = Sum
Worksheets("Inventory Activity Log").Cells(NewRow, 1).Value = Worksheets("form").Range("A" + thisRow).Value
Worksheets("Inventory Activity Log").Cells(NewRow, 2).Value = Worksheets("form").Range("B" + thisRow).Value
Worksheets("Inventory Activity Log").Cells(NewRow, 3).Value = Worksheets("form").Range("C" + thisRow).Value
Worksheets("Inventory Activity Log").Cells(NewRow, 4).Value = Worksheets("Active Inventory").Range("E" + thisRow).Value
Worksheets("Inventory Activity Log").Cells(NewRow, 5).Value = Worksheets("form").Range("F" + thisRow).Value
Worksheets("Inventory Activity Log").Cells(NewRow, 6).Value = Worksheets("form").Range("G" + thisRow).Value
Worksheets("Inventory Activity Log").Cells(NewRow, 7).Value = Worksheets("form").Range("H" + thisRow).Value
Worksheets("Inventory Activity Log").Cells(NewRow, 8).Value = Worksheets("form").Range("I" + thisRow).Value
Worksheets("Inventory Activity Log").Cells(NewRow, 9).Value = Worksheets("form").Range("J" + thisRow).Value
MsgBox "New Data added", vbOKOnly, "-WTG"
Worksheets("form").Range("G" + thisRow).ClearContents
Worksheets("form").Range("H" + thisRow).ClearContents
Worksheets("form").Range("I" + thisRow).ClearContents
Worksheets("form").Range("J" + thisRow).ClearContents
Worksheets("form").Range("N1").Value = NewRow
Worksheets("form").Range("G" + thisRow).Select
End If
End If
End Sub