Last active
September 9, 2016 18:33
-
-
Save roncat/dac3d1343e697305fa7b33bdcfc6c3e1 to your computer and use it in GitHub Desktop.
Macro para preenchimento automático em células no excel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Private Sub CommandButton1_Click() | |
Dim asque As Integer | |
asque = 65 | |
Dim cela As Integer | |
cela = ActiveCell.Row | |
Dim quantidade As Integer | |
quantidade = cela + Cells(1, 9) - 1 | |
Dim coluna As Integer | |
coluna = 4 | |
Dim valorLinha As String | |
valorLinha = Cells(1, 7) | |
'MsgBox asque | |
'MsgBox cela | |
'MsgBox quantidade | |
'MsgBox coluna | |
'MsgBox valorLinha | |
Do While cela <= quantidade | |
Dim temp As String | |
temp = Strings.Chr(asque) | |
'MsgBox temp | |
Cells(cela, coluna) = "=Plan1!" & temp & valorLinha | |
cela = cela + 1 | |
asque = asque + 1 | |
Loop | |
End Sub | |
Private Sub CommandButton2_Click() | |
Dim quantidade As Integer | |
Dim asque As Integer | |
asque = 78 | |
Dim cela As Integer | |
cela = ActiveCell.Row | |
quantidade = cela + Cells(1, 9) - 1 | |
Dim coluna As Integer | |
coluna = 5 | |
Dim valorLinha As String | |
valorLinha = Cells(1, 7) | |
'MsgBox asque | |
'MsgBox cela | |
'MsgBox quantidade | |
'MsgBox coluna | |
'MsgBox valorLinha | |
Do While cela <= quantidade | |
Dim temp As String | |
temp = Strings.Chr(asque) | |
'MsgBox temp | |
Cells(cela, coluna) = "=Plan1!" & temp & valorLinha | |
cela = cela + 1 | |
asque = asque + 1 | |
Loop | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment