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:

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type

Forum statistics

Threads
1,186,146
Messages
5,956,195
Members
438,238
Latest member
a cow tent

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top