crea copia de hoja a otra hoja

3 envíos / 0 nuevos
Último envío
tetorin
Imagen de tetorin
Offline
última acción: Hace 7 meses 1 semana
Nivel 1 - 200 puntosNivel 2 - 500 puntosNivel 3 - 1000 puntosNivel 4 - 2000 puntos
alta: 26/05/2011 - 02:57
Puntos: 3262
crea copia de hoja a otra hoja

buen dia , tengo esta macro que me copia la informacion de esta celda "AC1"a otra hoja de la columna "B" pero no encuentro la manera de que cuando no tenga dato la celda "AC1" me ponga un simbolo de "?"al copiar en la otra hoja de la columna "B"

 

anexo macro

Sub Copy_FECHA_EMISION()
    Dim SourceRange As Range, DestRange As Range
    Dim DestSheet As Worksheet, Lr As Long
               
    With Application
        .ScreenUpdating = False
        .EnableEvents = False
    End With
               
    'fill in the Source Sheet and range
    Set SourceRange = Sheets("PPS Format Front").Range("AC1")
               
    'Fill in the destination sheet and call the LastRow
    'function to find the last row
    Set DestSheet = Sheets("BASE DE DATOS")
    'Lr = LastRow(DestSheet)
     Lr = DestSheet.Cells(Rows.Count, "B").End(xlUp).Row
               
    'With the information from the LastRow function we can
    'create a destination cell and copy/paste the source range
    Set DestRange = DestSheet.Range("B" & Lr + 1)
    SourceRange.Copy DestRange
               
    With Application
        .ScreenUpdating = True
        .EnableEvents = True
    End With
               
End Sub

Etiquetas: 

pacomegia
Imagen de pacomegia
Offline
última acción: Hace 12 horas 48 mins
Nivel 1 - 200 puntosNivel 2 - 500 puntosNivel 3 - 1000 puntosNivel 4 - 2000 puntosNivel 5 - 4000 puntosadministrador
alta: 27/12/2006 - 23:26
Puntos: 11175
isempty

la función IsEmpty te dice si la celda está vacía

en tu caso comprueba si está vacío SourceRange

If IsEmpty(SourceRange) then ...

 

------
Ya sé Excel, pero necesito más.

tetorin
Imagen de tetorin
Offline
última acción: Hace 7 meses 1 semana
Nivel 1 - 200 puntosNivel 2 - 500 puntosNivel 3 - 1000 puntosNivel 4 - 2000 puntos
alta: 26/05/2011 - 02:57
Puntos: 3262
gracias si me funciono y feliz año nuevo 2015

Set SourceRange = Sheets("PPS Format Front").Range("AC1")
    If IsEmpty(SourceRange) Then
    SourceRange = "?"