Príloha nič moc, vychádzal som z makra, ktoré si sa tam snažil vytvoriť. Pre ilustráciu som nechal zakomentované pôvodné inštrukcie a pridal nové, o ktorých iba hádam, že by mali robiť snáď niečo, čo si zamýšľal, ale nie si schopný to ani zrozumiteľne v zadaní popísať.Private Sub Worksheet_Activate()
'tu je tvoj povodny kod
'For i = 1 To 10
' For j = 2 To 20
' For k = 3 To 30
'
' If Cells(2, 2) <> 0 Then
' Cells(2, 8) = Application.WorksheetFunction.Substitute(Cells(2, 2), " - ", "") & ";" & Cells(2, 1) & ";" & Application.WorksheetFunction.Substitute(Cells(1, 2), "1", "")
' Else
' Cells(2, 8) = ""
' End If
'
' Next k
' Next j
'Next i
'tu je snad funkcna modifikacia hore uvedeneho
For i = 2 To 4 'pomocna premenna pre stlpec
For j = 2 To 6 'pomocna premenna pre riadok
' For k = 3 To 30
If Cells(j, i) <> 0 Then
Cells(j, i + 6) = Application.WorksheetFunction.Substitute(Cells(j, i), " - ", "") & ";" & IIf(Cells(j, 1) = "", Cells(j - 1, 1), Cells(j, 1)) & ";" & Application.WorksheetFunction.Substitute(Cells(1, i), i - 1, "")
Else
Cells(j, i + 6) = ""
End If
' Next k
Next j
Next i
End Sub Riadok Cells(j, i + 6) = Application.WorksheetFunction.Substitute(Cells(j, i), " - ", "") & ";" & IIf(Cells(j, 1) = "", Cells(j - 1, 1), Cells(j, 1)) & ";" & Application.WorksheetFunction.Substitute(Cells(1, i), i - 1, "") by sa dal napísať i takto:Cells(j, i + 6) = Replace(Cells(j, i), " - ", "") & ";" & Cells((Int(j / 3) + (j Mod 3 = 0)) * 3 + 2, 1) & ";" & Replace(Cells(1, i), i - 1, "")Ty fakt tvoríš makrá v práci i pre kolegov? Neuveriteľné.citovat
'tu je tvoj povodny kod
'For i = 1 To 10
' For j = 2 To 20
' For k = 3 To 30
'
' If Cells(2, 2) <> 0 Then
' Cells(2, 8) = Application.WorksheetFunction.Substitute(Cells(2, 2), " - ", "") & ";" & Cells(2, 1) & ";" & Application.WorksheetFunction.Substitute(Cells(1, 2), "1", "")
' Else
' Cells(2, 8) = ""
' End If
'
' Next k
' Next j
'Next i
'tu je snad funkcna modifikacia hore uvedeneho
For i = 2 To 4 'pomocna premenna pre stlpec
For j = 2 To 6 'pomocna premenna pre riadok
' For k = 3 To 30
If Cells(j, i) <> 0 Then
Cells(j, i + 6) = Application.WorksheetFunction.Substitute(Cells(j, i), " - ", "") & ";" & IIf(Cells(j, 1) = "", Cells(j - 1, 1), Cells(j, 1)) & ";" & Application.WorksheetFunction.Substitute(Cells(1, i), i - 1, "")
Else
Cells(j, i + 6) = ""
End If
' Next k
Next j
Next i
End Sub Riadok Cells(j, i + 6) = Application.WorksheetFunction.Substitute(Cells(j, i), " - ", "") & ";" & IIf(Cells(j, 1) = "", Cells(j - 1, 1), Cells(j, 1)) & ";" & Application.WorksheetFunction.Substitute(Cells(1, i), i - 1, "") by sa dal napísať i takto:Cells(j, i + 6) = Replace(Cells(j, i), " - ", "") & ";" & Cells((Int(j / 3) + (j Mod 3 = 0)) * 3 + 2, 1) & ";" & Replace(Cells(1, i), i - 1, "")Ty fakt tvoríš makrá v práci i pre kolegov? Neuveriteľné.citovat