I
Ivica Lopar
In sheet1 I have some values.With this macro I wont to add new values in
sheet1 but i have an error.Can somebody help me.
Sub Dodaj()
Dim Pod(6)
Dim ind As Integer
With DialogSheets("DialogProdaja")
ind = .DropDowns(1).ListIndex
Pod(1) = .EditBoxes(1).Text
Pod(2) = .EditBoxes(2).Text
Pod(3) = .DropDowns(1).List(ind)
Pod(4) = .EditBoxes(3).Text
Pod(5) = .EditBoxes(4).Text
Pod(6) = .EditBoxes(5).Text
End With
If IsDate(Pod(1)) And IsNumeric(Pod(4)) And IsNumeric(Pod(5)) And
IsNumeric(Pod(6)) Then
With Worksheets("Prodaja")
NoviRed = .Cells(1, 1).CurrentRegion.Rows.Count + 1
For i = 1 To 6
..Cells(NoviRed, i).Value = Pod(i)
Next i
..Cells(NoviRed - 1, 7).AutoFill Destination:=Range(.Cells(NoviRed - 1, 7),
..Cells(NoviRed, 7)), Type:=xlFillDefault
..Cells(NoviRed, 1).NumberFormat = "dd-mm-yyyy."
..Cells(NoviRed, 6).Value = Pod(6) / 100
..Cells(NoviRed, 6).NumberFormat = "0%"
End With
Else
MsgBox prompt:="Podaci nisu ispravno uneseni", Buttons:=vbExclamation
End If
End Sub
regards
lopar
sheet1 but i have an error.Can somebody help me.
Sub Dodaj()
Dim Pod(6)
Dim ind As Integer
With DialogSheets("DialogProdaja")
ind = .DropDowns(1).ListIndex
Pod(1) = .EditBoxes(1).Text
Pod(2) = .EditBoxes(2).Text
Pod(3) = .DropDowns(1).List(ind)
Pod(4) = .EditBoxes(3).Text
Pod(5) = .EditBoxes(4).Text
Pod(6) = .EditBoxes(5).Text
End With
If IsDate(Pod(1)) And IsNumeric(Pod(4)) And IsNumeric(Pod(5)) And
IsNumeric(Pod(6)) Then
With Worksheets("Prodaja")
NoviRed = .Cells(1, 1).CurrentRegion.Rows.Count + 1
For i = 1 To 6
..Cells(NoviRed, i).Value = Pod(i)
Next i
..Cells(NoviRed - 1, 7).AutoFill Destination:=Range(.Cells(NoviRed - 1, 7),
..Cells(NoviRed, 7)), Type:=xlFillDefault
..Cells(NoviRed, 1).NumberFormat = "dd-mm-yyyy."
..Cells(NoviRed, 6).Value = Pod(6) / 100
..Cells(NoviRed, 6).NumberFormat = "0%"
End With
Else
MsgBox prompt:="Podaci nisu ispravno uneseni", Buttons:=vbExclamation
End If
End Sub
regards
lopar