Código: Text Private Function Desplazar(Valor As Integer, Direccion As String, nBits As Integer) As IntegerDim i As IntegerIf Not 0 < nBits < 16 Then Err.Raise 1001, , "Número de bits a desplazar incorrecto"Desplazar = ValorIf Direccion = "izq" Then 'Desplazamiento a la izquierda For i = 1 To nBits Desplazar = Desplazar * 2 Next iElseIf Direccion = "dch" Then 'Desplazamiento a la derecha For i = 1 To nBits Desplazar = Desplazar \ 2 Next iEnd IfEnd Function