#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 156
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 156
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dialog Pop Up Box Linda D F Excel Discussion (Misc queries) 1 May 16th 08 08:31 PM
How to delete the "Insert Function Dialog Box" (dialog box only)? TBI''d biker Excel Worksheet Functions 2 April 7th 07 09:18 PM
Help Dialog Box AgentX Excel Programming 2 May 5th 05 06:29 PM
Dialog Box Aussie Excel Discussion (Misc queries) 1 March 7th 05 03:56 PM
control of dialog macro dialog box. on open Gerry Abbott Excel Programming 0 July 22nd 04 05:41 PM


All times are GMT +1. The time now is 03:37 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"