You are on page 1of 1

Curso de Visual Excel

Soluciones a las Prcticas


Prctica n 2
Option Explicit
Sub insertarcolumna()
Columns("E:E").Select
Selection.Insert Shift:=xlToRight
Range("E1").Select
Columns("E:E").ColumnWidth = 6
End Sub
Sub formatear()
Range("A1:G1").Select
With Selection
.Interior.ColorIndex = 3
.Font.ColorIndex = 33
.Font.Bold = True
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
End With
End Sub
Sub borrarformato()
Range("A1:G1").Select
Selection.ClearFormats
End Sub
Sub practicados()
Dim fila As Byte
Dim beneficio, subtotal As Integer
Cells(2, 5).Select
For fila = 2 To 7
subtotal = Cells(fila, 2) * Cells(fila, 4)
Cells(fila, 5) = subtotal
Cells(fila, 6) = subtotal * 0.16
Cells(fila, 7) = subtotal * 1.16
beneficio = (Cells(fila, 4) - Cells(fila, 3)) * Cells(fila, 2)
Cells(fila, 8) = beneficio
Next fila
End Sub

Enrique Manuel Cabello Portero

You might also like