PS. Chyba muszę zmienić temat , ponieważ nie mogę dodać Ci punktów za pomoc - tak solidną i wyczerpującą pomoc...
Do you prefer the English version of the page elektroda?
No, thank you Send me over thereWorksheets("Styczeń")
Worksheets(2)
......
......
Worksheets("DANE").Unprotect
For i = 1 To 12
wartosc1 = Worksheets("DANE").Cells(i + 2, 29 + Numer).Value + Worksheets("DANE").Cells(i + 2, 4).Value
wartosc2 = Worksheets("DANE").Cells(i + 14, 29 + Numer).Value + Worksheets("DANE").Cells(i + 2, 12).Value
Worksheets("DANE").Cells(i + 2, 29 + Numer).Value = IIf(wartosc1 = 0, "", wartosc1)
Worksheets("DANE").Cells(i + 14, 29 + Numer).Value = IIf(wartosc2 = 0, "", wartosc2)
If Worksheets("DANE").Cells(i + 2, 4).Value <> 0 Then Worksheets("DANE").Cells(i + 2, 41 + Numer).Value = IIf(Worksheets("DANE").Cells(i + 2, 41 + Numer).Value <> "", Worksheets("DANE").Cells(i + 2, 41 + Numer).Value & ", " & Left(.TextBox2.Value, 2), Left(.TextBox2.Value, 2))
If Worksheets("DANE").Cells(i + 2, 12).Value <> 0 Then Worksheets("DANE").Cells(i + 14, 41 + Numer).Value = IIf(Worksheets("DANE").Cells(i + 14, 41 + Numer).Value <> "", Worksheets("DANE").Cells(i + 14, 41 + Numer).Value & ", " & Left(.TextBox2.Value, 2), Left(.TextBox2.Value, 2))
Next i
Worksheets("DANE").Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
......
..........
Facetjanusz wrote:
Po wpisaniu w tą pętlę kodu - faktycznie chroni arkusz - ale tylko podczas otworzenia arkusza DANE, i próbę wpisu w niepowołane rubryki. Natomiast w czasie działania programu i wpisywania kwoty - da się wpisać w każdą kolumnę...
If .ComboBox1.ListIndex = 0 Then
Worksheets("DANE").Unprotect
For i = 1 To 12
wartosc1 = Worksheets("DANE").Cells(i + 2, 29 + Numer).Value + Worksheets("DANE").Cells(i + 2, 4).Value
wartosc2 = Worksheets("DANE").Cells(i + 14, 29 + Numer).Value + Worksheets("DANE").Cells(i + 2, 12).Value
Worksheets("DANE").Cells(i + 2, 29 + Numer).Value = IIf(wartosc1 = 0, "", wartosc1)
Worksheets("DANE").Cells(i + 14, 29 + Numer).Value = IIf(wartosc2 = 0, "", wartosc2)
If Worksheets("DANE").Cells(i + 2, 4).Value <> 0 Then Worksheets("DANE").Cells(i + 2, 41 + Numer).Value = IIf(Worksheets("DANE").Cells(i + 2, 41 + Numer).Value <> "", Worksheets("DANE").Cells(i + 2, 41 + Numer).Value & ", " & Left(.TextBox2.Value, 2), Left(.TextBox2.Value, 2))
If Worksheets("DANE").Cells(i + 2, 12).Value <> 0 Then Worksheets("DANE").Cells(i + 14, 41 + Numer).Value = IIf(Worksheets("DANE").Cells(i + 14, 41 + Numer).Value <> "", Worksheets("DANE").Cells(i + 14, 41 + Numer).Value & ", " & Left(.TextBox2.Value, 2), Left(.TextBox2.Value, 2))
Next i
Worksheets("DANE").Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End If