Excelvbaplication 2010

Page 83

MS Excel con Programaci贸n de Macros en Visual Basic Application

Case Else Instrucciones en caso que no sean ninguno de los valores anteriores. End Select

Vea el ejemplo anterior solucionado con esta estructura. Ejemplo

Sub Ejemplo_16() Dim Signo As String Dim Valor1 As Integer, Valor2 As Integer, Total As Integer Valor1 = ActiveSheet.Range("A1").Value Valor2 = ActiveSheet.Range("A2").Value Signo = ActiveSheet.Range("A3").Value Select Case signo Case "+" Total = Valor1 + Valor2 Case "-" Total = Valor1 - Valor2 Case "x" Total = Valor1 * Valor2 Case ":" Total = Valor1 / Valor2 Ing. Patricia Acosta, MSc.

acostanp@gmail.com

83


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.