Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Dialog
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Dialog
Hi,
aren't all lines like this: ...Cells(NoviRed, ... supposed to be like this: ..Cells(NoviRed, ... In the With block, you have 2 full-stops (..) - I think it should always be only one. hence: NEW CODE 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 CODE <<<<< If not that, then tell us what line the error happens on, and what the error is. HTH Philip "Ivica Lopar" wrote: 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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Dialog
Error Variable not defined (Novi red)
NoviRed = .Cells(1, 1).CurrentRegion.Rows.Count + 1 "Ivica Lopar" wrote in message ... 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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Dialog
Error Variable not defined ( red).same error in this code.
red = .DropDowns(1).ListIndex + 1 Sub OdabirKnjige() Dim cijena As Integer With DialogSheets("DialogProdaja") red = .DropDowns(1).ListIndex + 1 cijena = Worksheets("Knjige").Cells(red, 2).Value ..EditBoxes(4).Text = cijena ..EditBoxes(3).Text = 1 ..EditBoxes(5).Text = 0 ..Labels(8).Text = cijena ..Spinners(1).Value = 1 ..Spinners(2).Value = 0 End With "Philip" wrote in message ... Hi, aren't all lines like this: ..Cells(NoviRed, ... supposed to be like this: .Cells(NoviRed, ... In the With block, you have 2 full-stops (..) - I think it should always be only one. hence: NEW CODE 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 CODE <<<<< If not that, then tell us what line the error happens on, and what the error is. HTH Philip "Ivica Lopar" wrote: 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 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Dialog
Ah !
Sorry, I should have checked for that too :) try this code (I have added new 'Dim' statements for NoviRed and i) NEW CODE Sub Dodaj() Dim Pod(6) Dim ind As Integer Dim NoviRed As Long, i 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 <<< END CODE <<< Whenever you see an error like that, always check that the highlighted variable or statement has a DIM for it.... either locally in the procedure, or in the module. HTH Philip "Ivica Lopar" wrote: Error Variable not defined (Novi red) NoviRed = .Cells(1, 1).CurrentRegion.Rows.Count + 1 "Ivica Lopar" wrote in message ... 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 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Dialog
thanks for help it is working now
regards lopar "Philip" wrote in message ... Ah ! Sorry, I should have checked for that too :) try this code (I have added new 'Dim' statements for NoviRed and i) NEW CODE Sub Dodaj() Dim Pod(6) Dim ind As Integer Dim NoviRed As Long, i 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 <<< END CODE <<< Whenever you see an error like that, always check that the highlighted variable or statement has a DIM for it.... either locally in the procedure, or in the module. HTH Philip "Ivica Lopar" wrote: Error Variable not defined (Novi red) NoviRed = .Cells(1, 1).CurrentRegion.Rows.Count + 1 "Ivica Lopar" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Dialog Pop Up Box | Excel Discussion (Misc queries) | |||
How to delete the "Insert Function Dialog Box" (dialog box only)? | Excel Worksheet Functions | |||
Help Dialog Box | Excel Programming | |||
Dialog Box | Excel Discussion (Misc queries) | |||
control of dialog macro dialog box. on open | Excel Programming |