G
Gunnar
Hi,
I have declared a variable as Integer, and I am trying to
put a value into it, but it will not work.
Is the sentence below wrong?? When I use F8 the value of
the cell is 0.3..but it will not be transferred into
PVK....what is wrong?
PVK = ShtMatrise.Range("BJ" & ProduktRad2).Value
Does anyone have a clue on this one?
Help is highly appreciated...
Gunnar
------
here is the total code
Sub FindPVC()
Dim Produkt1 As Long
Dim Produkt2 As Long
Dim PasteRow As Integer
Dim ProduktRad1 As Long
Dim ProduktRad2 As Long
Dim PVK As Integer
Dim ShtFlasker As Worksheet
Set ShtFlasker = Sheets("Flasker")
Dim ShtMatrise As Worksheet
Set ShtMatrise = Sheets("Matrise")
' Turn off screen updating to speed up macro.
Application.ScreenUpdating = False
ShtFlasker.Activate
ProduktRad1 = 6
ProduktRad2 = 13
PasteRow = 6
Produkt1 = Range("F" & ProduktRad1).Value 'legger inn
mat.# i flasker
For Each c In Range("ProduktListe")
ShtMatrise.Activate
Produkt2 = Range("C" & ProduktRad2).Value 'legger inn
mat# i matrise arket
Do While Produkt1 = Produkt2 ' viss match
'ShtMatrise.Activate
PVK = ShtMatrise.Range("BJ" & ProduktRad2).Value '
hente PVk verdi
Selection.Copy
ShtFlasker.Range("T" & PasteRow) = PVK ' overfør
verdien
PasteRow = PasteRow + 1 ' øk med en
ProduktRad1 = ProduktRad1 + 1
Loop
ProduktRad2 = ProduktRad2 + 1
Next c
'ProduktRad1 = ProduktRad1 + 1
Application.ScreenUpdating = True
MsgBox "Finished!"
End Sub
I have declared a variable as Integer, and I am trying to
put a value into it, but it will not work.
Is the sentence below wrong?? When I use F8 the value of
the cell is 0.3..but it will not be transferred into
PVK....what is wrong?
PVK = ShtMatrise.Range("BJ" & ProduktRad2).Value
Does anyone have a clue on this one?
Help is highly appreciated...
Gunnar
------
here is the total code
Sub FindPVC()
Dim Produkt1 As Long
Dim Produkt2 As Long
Dim PasteRow As Integer
Dim ProduktRad1 As Long
Dim ProduktRad2 As Long
Dim PVK As Integer
Dim ShtFlasker As Worksheet
Set ShtFlasker = Sheets("Flasker")
Dim ShtMatrise As Worksheet
Set ShtMatrise = Sheets("Matrise")
' Turn off screen updating to speed up macro.
Application.ScreenUpdating = False
ShtFlasker.Activate
ProduktRad1 = 6
ProduktRad2 = 13
PasteRow = 6
Produkt1 = Range("F" & ProduktRad1).Value 'legger inn
mat.# i flasker
For Each c In Range("ProduktListe")
ShtMatrise.Activate
Produkt2 = Range("C" & ProduktRad2).Value 'legger inn
mat# i matrise arket
Do While Produkt1 = Produkt2 ' viss match
'ShtMatrise.Activate
PVK = ShtMatrise.Range("BJ" & ProduktRad2).Value '
hente PVk verdi
Selection.Copy
ShtFlasker.Range("T" & PasteRow) = PVK ' overfør
verdien
PasteRow = PasteRow + 1 ' øk med en
ProduktRad1 = ProduktRad1 + 1
Loop
ProduktRad2 = ProduktRad2 + 1
Next c
'ProduktRad1 = ProduktRad1 + 1
Application.ScreenUpdating = True
MsgBox "Finished!"
End Sub