Skip to content

Instantly share code, notes, and snippets.

@guaxinim
Created September 6, 2016 20:10
Show Gist options
  • Save guaxinim/7720d2f30e600479d4a64d5a92a73329 to your computer and use it in GitHub Desktop.
Save guaxinim/7720d2f30e600479d4a64d5a92a73329 to your computer and use it in GitHub Desktop.
Macro de preenchimento automático no excel
Private Sub CommandButton1_Click()
Dim quantidade As Integer
Dim asque As Integer
asque = 65
Dim cela As Integer
cela = ActiveCell.Row
quantidade = cela + Cells(1, 9) - 1
Dim coluna As Integer
coluna = 4
Dim valorLinha As String
valorLinha = Cells(1, 7)
Do While cela <= quantidade
Dim temp As String
temp = Strings.Chr(asque)
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 = 77
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)
Do While cela <= quantidade
Dim temp As String
temp = Strings.Chr(asque)
Cells(cela, coluna) = "=Plan1!" & temp & valorLinha
cela = cela + 1
asque = asque + 1
Loop
End Sub
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment