-
Posts
2 -
Cadastrado em
-
Última visita
Tipo de conteúdo
Artigos
Selos
Fabricantes
Livros
Cursos
Análises
Fórum
posts postados por Joás Lima
-
-
alguem ai que possa ajudar com vba?
o problema é: quero mudar de coluna, a cada contagem de linha.
ex.: a cada 100 linhas contadas, uma coluna.
eu consigo mudar de linha mas nao consigo mudar de coluna.
eis a situação do codigo:Sub numberlist()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManualDim a1 As Single
Dim b1 As Single
Dim c1 As Single
Dim d1 As Single
Dim e1 As Single
Dim f1 As Single
Dim g1 As Single
Dim h1 As Single
Dim i1 As Single
Dim j1 As Single
Dim count As Integer
Dim lrow As Long
Dim lcolumn As Integera1 = 0
b1 = 0
c1 = 0
d1 = 0
e1 = 0
f1 = 0
g1 = 0
h1 = 0
i1 = 0
For a1 = 0 To 1 Step 1
For b1 = 0 To 1 Step 1
For c1 = 0 To 1 Step 1
For d1 = 0 To 1 Step 1
For e1 = 0 To 1 Step 1
For f1 = 0 To 1 Step 1
For g1 = 0 To 1 Step 1
For h1 = 0 To 1 Step 1
For i1 = 0 To 1 Step 1
lrow = Cells(Rows.count, "A").End(xlUp).Row + 1
Cells(lrow, "A") = a1 & b1 & c1 & d1 & e1 & f1 & g1 & h1 & i1 & j1
If lrow Mod 100 = 0 Then
Application.EnableEvents = False
lcolumn = Range(1, Columns.count).Next(xlToRight).Column + 1
lrow = 0
lrow = Cells(Rows.count, Columns.count).End(xlUp).Row + 1
Cells(lrow, "A") = a1 & b1 & c1 & d1 & e1 & f1 & g1 & h1 & i1 & j1
Else
End If
Next
Next
Next
Next
Next
Next
Next
Next
Next
Application.EnableEvents = True
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub
Sobre o Clube do Hardware
No ar desde 1996, o Clube do Hardware é uma das maiores, mais antigas e mais respeitadas comunidades sobre tecnologia do Brasil. Leia mais
Direitos autorais
Não permitimos a cópia ou reprodução do conteúdo do nosso site, fórum, newsletters e redes sociais, mesmo citando-se a fonte. Leia mais
Macro para mudar de coluna a cada contagem
em Microsoft Office e similares
Postado
Consegui!
funciona desta forma:
Sub numberlist()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim a1 As Single
Dim b1 As Single
Dim c1 As Single
Dim d1 As Single
Dim e1 As Single
Dim f1 As Single
Dim g1 As Single
Dim h1 As Single
Dim i1 As Single
Dim j1 As Single
Dim count As Integer
Dim lrow As Long
Dim lcolumn As Long
a1 = 0
b1 = 0
c1 = 0
d1 = 0
e1 = 0
f1 = 0
g1 = 0
h1 = 0
i1 = 0
lcolumn = 1
For a1 = 0 To 2 Step 1
For b1 = 0 To 2 Step 1
For c1 = 0 To 2 Step 1
For d1 = 0 To 2 Step 1
For e1 = 0 To 2 Step 1
For f1 = 0 To 2 Step 1
For g1 = 0 To 2 Step 1
For h1 = 0 To 2 Step 1
For i1 = 0 To 2 Step 1
lrow = Cells(Rows.count, lcolumn).End(xlUp).Row + 1
Cells(lrow, lcolumn) = a1 & b1 & c1 & d1 & e1 & f1 & g1 & h1 & i1 & j1
If lrow Mod 1000 = 0 Then
lcolumn = lcolumn + 1
lrow = 1
Else
End If
Next
Next
Next
Next
Next
Next
Next
Next
Next
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub