Želim, da makro naredi oznako v vrstici v kateri se celica ujema s celico na seznamu. Makro javlja napako v zvezi z deklaracijo spremeljivk. V vseh celicah je text.
Sub Premet()
Dim defin As Integer
Dim vsi As Integer
Dim x As Integer
x = 11 ' zamik v desno
For defin = 2 To 143 ' izbrani projekti
For vsi = 2 To 2267 ' vsi projekti
If Cells(defin, x).Value = Cells(vsi, x - .Value Then
Cells(vsi, x - 2).Value = "ta"
ActiveWindow.ScrollRow = vsi
End If
Next vsi
Next defin
End Sub
Iskanje - določanje
Javi
Type mismatch (Error 13)
Visual Basic is able to convert and coerce many values to accomplish data type assignments that weren't possible in earlier versions. However, this error can still occur and has the following causes and solutions:
The variable or property isn't of the correct type. For example, a variable that requires an integer value can't accept a string value unless the whole string can be recognized as an integer.
Try to make assignments only between compatible data types. For example, an Integer can always be assigned to a Long, a Single can always be assigned to a Double, and any type (except a user-defined type) can be assigned to a Variant.
An object was passed to a procedure that is expecting a single property or value.
Pass the appropriate single property or call a method appropriate to the object.
A module or project name was used where an expression was expected, for example:
Debug.Print MyModule
Specify an expression that can be displayed.
You attempted to mix traditional Basic error handling with Variant values having the Error subtype (10, vbError), for example:
Error CVErr(n)
To regenerate an error, you must map it to an intrinsic Visual Basic or a user-defined error, and then generate that error.
A CVErr value can't be converted to Date. For example:
MyVar = CDate(CVErr(9))
Type mismatch (Error 13)
Visual Basic is able to convert and coerce many values to accomplish data type assignments that weren't possible in earlier versions. However, this error can still occur and has the following causes and solutions:
The variable or property isn't of the correct type. For example, a variable that requires an integer value can't accept a string value unless the whole string can be recognized as an integer.
Try to make assignments only between compatible data types. For example, an Integer can always be assigned to a Long, a Single can always be assigned to a Double, and any type (except a user-defined type) can be assigned to a Variant.
An object was passed to a procedure that is expecting a single property or value.
Pass the appropriate single property or call a method appropriate to the object.
A module or project name was used where an expression was expected, for example:
Debug.Print MyModule
Specify an expression that can be displayed.
You attempted to mix traditional Basic error handling with Variant values having the Error subtype (10, vbError), for example:
Error CVErr(n)
To regenerate an error, you must map it to an intrinsic Visual Basic or a user-defined error, and then generate that error.
A CVErr value can't be converted to Date. For example:
MyVar = CDate(CVErr(9))
Mislim, da coda deluje na številkah na tekstu pa ne. Podobno je s to:
Sub Premet()
Dim defin As Integer
Dim vsi As Integer
Dim x As Integer
x = 11 ' zamik v desno
For defin = 2 To 143 ' izbrani projekti
For vsi = 2 To 2267 ' vsi projekti
If Cells(defin, x).Value = Cells(vsi, x - 8).Value Then
Cells(defin, x + 1).Value = Cells(vsi, x - 10).Value And _
Cells(defin, x + 2).Value = Cells(vsi, x - 9).Value And _
Cells(defin, x + 3).Value = Cells(vsi, x - 7).Value And _
Cells(defin, x + 4).Value = Cells(vsi, x - 6).Value And _
Cells(defin, x + 5).Value = Cells(vsi, x - 5).Value
End If
Next vsi
ActiveWindow.ScrollRow = defin
'ActiveWorkbook.RefreshAll
Next defin
End Sub
Sub Premet()
Dim defin As Integer
Dim vsi As Integer
Dim x As Integer
x = 11 ' zamik v desno
For defin = 2 To 143 ' izbrani projekti
For vsi = 2 To 2267 ' vsi projekti
If Cells(defin, x).Value = Cells(vsi, x - 8).Value Then
Cells(defin, x + 1).Value = Cells(vsi, x - 10).Value And _
Cells(defin, x + 2).Value = Cells(vsi, x - 9).Value And _
Cells(defin, x + 3).Value = Cells(vsi, x - 7).Value And _
Cells(defin, x + 4).Value = Cells(vsi, x - 6).Value And _
Cells(defin, x + 5).Value = Cells(vsi, x - 5).Value
End If
Next vsi
ActiveWindow.ScrollRow = defin
'ActiveWorkbook.RefreshAll
Next defin
End Sub
Hm... Zadnja koda nima smisla...
Tole lahko ima nek smisel:
Če pa vmes tlačite operator 'AND' pa je to lahko kvečjemu testni pogoj (v npr. if stavku)!
Tole lahko ima nek smisel:
Koda: Izberi vse
Cells(defin, x + 1).Value = Cells(vsi, x - 10).Value
Cells(defin, x + 2).Value = Cells(vsi, x - 9).Value
Cells(defin, x + 3).Value = Cells(vsi, x - 7).Value
Cells(defin, x + 4).Value = Cells(vsi, x - 6).Value
Cells(defin, x + 5).Value = Cells(vsi, x - 5).Value
lp,
Matjaž Prtenjak
Administrator
Matjaž Prtenjak
Administrator