Forum » Programiranje » Excel Macro
Excel Macro
CHAOS ::
Kako excel prepricam, da mi prekopira sledece:
For i = 1 To 501
Range("A[2*i-1]:C[2*i-1]").Select
Selection.Copy
Range("H[i]:J[i]").Select
ActiveSheet.Paste
Range("D[2*i]:F[2*i]").Select
Application.CutCopyMode = False
Selection.Copy
Range("H[2*i]:J[2*i]").Select
ActiveSheet.Paste
Next i
Se pravi, da imam 6 stolpcev od katerih zelim zadnje tri prekopirat v novo vrstico, tako da na koncu dobim podatke s samo tremi stolpci. Tnx vsem ze v naprej.
For i = 1 To 501
Range("A[2*i-1]:C[2*i-1]").Select
Selection.Copy
Range("H[i]:J[i]").Select
ActiveSheet.Paste
Range("D[2*i]:F[2*i]").Select
Application.CutCopyMode = False
Selection.Copy
Range("H[2*i]:J[2*i]").Select
ActiveSheet.Paste
Next i
Se pravi, da imam 6 stolpcev od katerih zelim zadnje tri prekopirat v novo vrstico, tako da na koncu dobim podatke s samo tremi stolpci. Tnx vsem ze v naprej.
'They have computers, and they may have other weapons of mass destruction.'
Tutankhamun ::
Nimam lih excella ampak:
Pri vsakem Range bi jest tko naredu: primer za prvega
Range("A" & 2*i-1 & ":" & "C" & 2*i-1).Select
če pa to ne dela pa probi tko:
myRange = "A" & 2*i-1 & ":" & "C" & 2*i-1
Range(myRange).Select
In potem še za vse druge.
Pri vsakem Range bi jest tko naredu: primer za prvega
Range("A" & 2*i-1 & ":" & "C" & 2*i-1).Select
če pa to ne dela pa probi tko:
myRange = "A" & 2*i-1 & ":" & "C" & 2*i-1
Range(myRange).Select
In potem še za vse druge.
CHAOS ::
Tnx Tutan Sicer, kar sem napisal je bilo malo nesmiselno, vendar je glavna bila sintaksa. :) No, to je to kar sem hotel narediti. Mogoce bo se kdo kdaj rabil:
For i = 1 To 502
Range("A" & (i) & ":" & "C" & (i)).Select
Selection.Copy
Range("H" & (2 * i - 1) & ":" & "J" & (2 * i - 1)).Select
ActiveSheet.Paste
Range("D" & (i) & ":" & "F" & (i)).Select
Application.CutCopyMode = False
Selection.Copy
Range("H" & (2 * i) & ":" & "J" & (2 * i)).Select
ActiveSheet.Paste
Next i
For i = 1 To 502
Range("A" & (i) & ":" & "C" & (i)).Select
Selection.Copy
Range("H" & (2 * i - 1) & ":" & "J" & (2 * i - 1)).Select
ActiveSheet.Paste
Range("D" & (i) & ":" & "F" & (i)).Select
Application.CutCopyMode = False
Selection.Copy
Range("H" & (2 * i) & ":" & "J" & (2 * i)).Select
ActiveSheet.Paste
Next i
'They have computers, and they may have other weapons of mass destruction.'
Vredno ogleda ...
Tema | Ogledi | Zadnje sporočilo | |
---|---|---|---|
Tema | Ogledi | Zadnje sporočilo | |
» | Word 2003 VBA problemOddelek: Programska oprema | 1036 (923) | mimax |
» | access -> word ali excelOddelek: Programska oprema | 1222 (1163) | zavajon |
» | [Excel] problem z makrojem, visual basic (strani: 1 2 )Oddelek: Programiranje | 5656 (5119) | steev |
» | Excel - klic podatkov iz druge datotekeOddelek: Programska oprema | 1504 (1343) | pirat |
» | Kako v excelu shraniti kot sliko?Oddelek: Programska oprema | 2527 (2226) | Slavček |