Problem with code

margot

New Member
Joined
May 20, 2011
Messages
1
Hi Everybody!
I'm new here and I really hope, that there is sb here who can help me with problem I'm stuck with. First things first: there is the part of code I have problems with:

Code:
Dim Laenge As Integer
row = 6
Do While row <> RowEnde + 1
On Error GoTo ende1
 
Sheets("PCExupload Run1").Range("a" & row).Value = Sheets(SheetName).Range("B" & row - 2).Value
Sheets("PCExupload Run1").Range("b" & row).Value = Sheets(SheetName).Range("c" & row - 2).Value
Laenge = Len((Sheets(SheetName).Range("d" & row - 2).Value) * 100)
Debug.Print Laenge
If Laenge > 1 Then
Sheets("PCExupload Run1").Range("c" & row).Value = Left((Sheets(SheetName).Range("d" & row - 2).Value) * 100, Len((Sheets(SheetName).Range("d" & row - 2).Value) * 100) - 2) & "." & Right((Sheets(SheetName).Range("d" & row - 2).Value) * 100, 2)
Else
Sheets("PCExupload Run1").Range("c" & row).Value = 0 & "." & 0 & Right((Sheets(SheetName).Range("d" & row - 2).Value) * 100, 2)
End If
Debug.Print Left((Sheets(SheetName).Range("d" & row - 2).Value) * 100, Len((Sheets(SheetName).Range("d" & row - 2).Value) * 100) - 2); Right((Sheets(SheetName).Range("d" & row - 2).Value) * 100, 2)
Sheets("PCExupload Run1").Range("d" & row).Value = Sheets(SheetName).Range("e" & row - 2).Value
Sheets("PCExupload Run1").Range("e" & row).Value = Sheets(SheetName).Range("f" & row - 2).Value
Sheets("PCExupload Run1").Range("f" & row).Value = Sheets(SheetName).Range("g" & row - 2).Value
Sheets("PCExupload Run1").Range("g" & row).Value = Sheets(SheetName).Range("h" & row - 2).Value
Sheets("PCExupload Run1").Range("h" & row).Value = Sheets(SheetName).Range("i" & row - 2).Value
Sheets("PCExupload Run1").Range("i" & row).Value = Sheets(SheetName).Range("j" & row - 2).Value
Sheets("PCExupload Run1").Range("j" & row).Value = Sheets(SheetName).Range("k" & row - 2).Value
Sheets("PCExupload Run1").Range("k" & row).Value = Sheets(SheetName).Range("l" & row - 2).Value
Sheets("PCExupload Run1").Range("l" & row).Value = Sheets(SheetName).Range("m" & row - 2).Value
Sheets("PCExupload Run1").Range("m" & row).Value = Sheets(SheetName).Range("n" & row - 2).Value
Sheets("PCExupload Run1").Range("n" & row).Value = Sheets(SheetName).Range("o" & row - 2).Value
Sheets("PCExupload Run1").Range("o" & row).Value = Sheets(SheetName).Range("p" & row - 2).Value
Sheets("PCExupload Run1").Range("p" & row).Value = Sheets(SheetName).Range("q" & row - 2).Value
Sheets("PCExupload Run1").Range("q" & row).Value = Sheets(SheetName).Range("r" & row - 2).Value
Sheets("PCExupload Run1").Range("r" & row).Value = Sheets(SheetName).Range("s" & row - 2).Value
Sheets("PCExupload Run1").Range("s" & row).Value = Sheets(SheetName).Range("t" & row - 2).Value
row = row + 1
Loop
Sheets("Instructions").Select
 
'Buch = (Sheets("Key Blumen").Range("d" & row - 2).Value) * 100
'Debug.Print Buch2
ende1:
MsgBox ("Daten sind kopiert und formatiert")
 
End Sub

Thing is, for values <0,0X the code stopped previously, so I figured the lenght should be checked, but now it functions in way that is a bad one - doesn't stop while value<0,0X but doesn't return the "." instead of "," either.

Does anybody have an idea how to debug this? I would really appreciate - I'm still new to this VBA coding and walking in darkness - just to explain I inherited the original code and than changed so it could work for the new model.

thank you!!!
 
Last edited by a moderator:

Forum statistics

Threads
1,085,577
Messages
5,384,546
Members
401,907
Latest member
Djmason2001

Some videos you may like

This Week's Hot Topics

Top