Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub CommandButton1_Click()
- Dim iRow As Integer
- Dim myRange As Range
- 'Make Sheet1 active
- Plan2.Activate
- 'Conta quantas empresas tem (Quantas linhas tem)
- Set myRange = Range("A4", "A6000")
- lastRow = WorksheetFunction.CountA(myRange)
- Dim count As Integer
- count = 1
- 'coluna que vai receber a soma
- Dim colunaSoma As Integer
- colunaSoma = 8
- While count <= lastRow
- 'Soma todas as contas e coloca na Coluna = colunaSoma
- Cells(count, colunaSoma).Value = Cells(count, 2).Value + Cells(count, 3).Value + Cells(count, 4).Value + Cells(count, 5).Value + Cells(count, 6).Value + Cells(count, 7).Value + Cells(count, 8).Value
- count = count + 1
- Wend
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement