Sub EmitirRecibosDesdeLista()
Dim ws As Worksheet
Dim celdaSelector As Range
Dim lista As Range
Dim c As Range
Dim total As Long, contador As Long
'Hoja donde están P17 y la lista U16:U...
Set ws = Sheets("CONSULTAS")
'Celda donde se coloca cada código
Set celdaSelector = ws.Range("P17")
'Lista de códigos
Set lista = ws.Range("U16:U500")
'Calcular cantidad de códigos
total = ws.Cells(ws.Rows.Count, "U").End(xlUp).Row - 15
If total <= 0 Then
MsgBox "No hay códigos en la lista (columna U).", vbExclamation
Exit Sub
End If
Application.ScreenUpdating = False
Application.DisplayAlerts = False
contador = 0
For Each c In lista
If c.Value = "" Then Exit For
contador = contador + 1
'Colocar código en P17
celdaSelector.Value = c.Value
DoEvents
'------------------------------------------------------------
' EJECUTA AQUÍ LA MACRO DE EMISIÓN DEL RECIBO
'------------------------------------------------------------
'Recibos PROPIETARIOS:
Call Imagen13_Haga_clic_en
'Si quisieras Inquilinos, activa esta y comenta la otra:
'Call powerbuttonINQ
'------------------------------------------------------------
'Espera 2 segundos para que finalice bien la exportación y el envío
Application.Wait Now + TimeValue("0:00:02")
Next c
Application.ScreenUpdating = True
MsgBox "Proceso finalizado. Se emitieron " & contador & " recibos.", vbInformation
End Sub
Por
JSDJSD , · publicado hace 5 horas 5 hr
Buen día, alguien puede ayudarme con la siguiente consulta por favor: Porque la sumatoria de los subtotales y el total no me sale correctamente, el año 2017 el total debe ser 47 y me muestra 45, el año 2018 el total debe ser 9 y me muestra 8. Porque pasa esto?
Consulta Sumatoria.pdf