Está en la página 1de 5

AGREGAR/MODIFICAR CLIENTE

Worksheets("Clientes").Activate
Range("a4").Select
fila = 4
luz = "no"
Do While ActiveCell <> "" And luz = "no"
If UCase(rut.Text) = UCase(ActiveCell) Then
luz = "si"
MsgBox "el cliente ya exite ", vbInformation +
vbOKOnly //////////////////
If MsgBox("Seguro que quiere modificar este cliente?", vbQuestion +
vbYesNo) = vbYes Then

Cells(fila, 3) = direc.Text
Cells(fila, 4) = tel.Text

MsgBox "Cliente modificado", vbInformation + vbOKOnly


cbo_Nombre.SetFocus

End If ///////////////////////////////////////////////////////////////////////////

cacha .SetFocus
Else
Selection.Offset(1, 0).Select
fila = fila + 1
End If
Loop
If luz = "no" Then
Cells(fila, 1) = rut.Text
Cells(fila, 2) = nombre.Text
Cells(fila, 3) = direc.Text
Cells(fila, 4) = tel.Text

End If
End Sub
AGREGAR HORA
Worksheets(cancha.Text).Activate
Range("a4").Select
fila = 4
luz = "no"

Do While ActiveCell <> "" And luz = "no"


If UCase(dia.Text) = UCase(ActiveCell) Then
Selection.Offset(0, 1).Select
If UCase(hora.Text) = UCase(ActiveCell) Then
luz = "si"
MsgBox "cacha ocupada ", vbInformation +
vbOKOnly
cancha .SetFocus
Selection.Offset(0, -1).Select
Else
Selection.Offset(0, -1).Select
End If

Else
Selection.Offset(1, 0).Select
fila = fila + 1
End If
Loop
If luz = "no" Then
Cells(fila, 1) = dia.Text
Cells(fila, 2) = hora.Text
Cells(fila, 3) = nombre.Text

Worksheets("reservas").Activate
Range("a4").Select
fila = 4

Do While ActiveCell <> ""

Selection.Offset(1, 0).Select
fila = fila + 1

Loop

Cells(fila, 1) = dia.Text
Cells(fila, 2) = hora.Text
Cells(fila, 3) = cancha.Text
Cells(fila, 4) = nombre.Text
Cells(fila, 5) = implemento.Text

rut.Text = ""
nombre.Text = ""
direc.Text = ""
tel.Text = ""
cancha.Text = ""
dia.Text = ""
hora.Text = ""
implemento.Text = ""

End If

End Sub
ELIMINAR RESERVA
Worksheets(cancha.Text).Activate
Range("a4").Select
fila = 4
luz = "no"
Do While ActiveCell <> "" And luz = "no"
If UCase(dia.Text) = UCase(ActiveCell) Then
Selection.Offset(0, 1).Select
If UCase(hora.Text) = UCase(ActiveCell) Then
luz = "si"
Cells(fila, 1) = ""
Cells(fila, 2) = ""
Cells(fila, 3) = ""

Worksheets("reservas").Activate //////////////////////////////////
Range("a4").Select
fila = 4
Do While ActiveCell <> ""
If UCase(dia.Text) = UCase(ActiveCell) Then
Selection.Offset(0, 1).Select
If UCase(hora.Text) = UCase(ActiveCell) Then
Selection.Offset(0, 1).Select
If UCase(cancha.Text) = UCase(ActiveCell)
Then
Cells(fila, 1) = ""
Cells(fila, 2) = ""
Cells(fila, 3) = ""
Cells(fila, 4) = ""
Cells(fila, 5) = ""
MsgBox "reserva eliminada ", vbInformation +
vbOKOnly
Else
Selection.Offset(1, 0).Select
fila = fila + 1
End If
Loop
cancha .SetFocus
Selection.Offset(0, -1).Select
Else
Selection.Offset(0, -1).Select
End If
Else
Selection.Offset(1, 0).Select
fila = fila + 1
End If
Loop
If luz = "no" Then
MsgBox "no existe la reserva ", vbInformation + vbOKOnly
cancha .SetFocus
End If
End Sub
MODIFICAR RESERVA
Worksheets(cancha.Text).Activate
Range("a4").Select
fila = 4
luz = "no"
Do While ActiveCell <> "" And luz = "no"
If UCase(dia.Text) = UCase(ActiveCell) Then
Selection.Offset(0, 1).Select
If UCase(hora.Text) = UCase(ActiveCell) Then
luz = "si"
Cells(fila, 1) = dia
Cells(fila, 2) = hora
Cells(fila, 3) = nombre

Worksheets("reservas").Activate //////////////////////////////
Range("a4").Select
fila = 4
Do While ActiveCell <> ""
If UCase(dia.Text) = UCase(ActiveCell) Then
Selection.Offset(0, 1).Select
If UCase(hora.Text) = UCase(ActiveCell) Then
Selection.Offset(0, 1).Select
If UCase(cancha.Text) = UCase(ActiveCell)
Then
Cells(fila, 1) = dia.Text
Cells(fila, 2) = hora.Text
Cells(fila, 3) = cancha.Text
Cells(fila, 4) = nombre.Text
Cells(fila, 5) = implemento.Text
MsgBox "reserva modificada ", vbInformation
+ vbOKOnly
Else
Selection.Offset(1, 0).Select
fila = fila + 1
End If
Loop
cancha .SetFocus
Selection.Offset(0, -1).Select
Else
Selection.Offset(0, -1).Select
End If
Else
Selection.Offset(1, 0).Select
fila = fila + 1
End If
Loop
If luz = "no" Then
MsgBox "no existe la reserva ", vbInformation + vbOKOnly
cancha .SetFocus
End If
End Sub

También podría gustarte