Condición si la celda esta vacía

Estimado, necesito de tu ayuda, podrías decirme como agregar una condición a este código si es que la celda A1 esta vacía, solicitar ingresar la fecha.

__________codigo________________

Sub creaplanilla_MI()
Set hactual = Sheets(1)
Set hdest = Sheets(2)
hactual.Select
ufila = Range("A" & Rows.Count).End(xlUp).Row
ucol = ActiveCell.SpecialCells(xlLastCell).Column
hdest.Columns("C").NumberFormat = "mm\/yyyy"
j = 1
For k = 34 To ucol
If IsNumeric(hactual.Cells(1, k)) And hactual.Cells(1, k) <> "" And hactual.Cells(2, k) = "MI" Then
For i = 7 To ufila
If Cells(i, 1) <> "" Then
hdest.Cells(j, 1) = "'" & hactual.Cells(1, k)
hdest.Cells(j, 2) = "'" & hactual.Cells(i, 1)
hdest.Cells(j, 3) = hactual.Cells(1, 1) ' aquí lo hace pero si la celda esta vacía, el resultado es vacío, asi que necesito que si no ingresaron la fecha en la celda A1, que con un mensaje me diga que tengo que ingresarla sino que siga corriendo el programa"
If hactual.Cells(i, k) = "" _
Or Not IsNumeric(hactual.Cells(i, k)) Then
hdest.Cells(j, 4) = 0
Else
hdest.Cells(j, 4) = hactual.Cells(i, k) * 1000
End If
j = j + 1
End If
Next
End If
Next
MsgBox ("**Datos de MARCAS INTERNACIONALES importados en la 2da Hoja**")
End Sub

Saludos.

1 Respuesta

Respuesta
1

Inserta las líneas en la macro según se indica:

Sub creaplanilla_MI()
Set hactual = Sheets(1)
Set hdest = Sheets(2)
hactual.Select

'Insertar estas líneas
If Not IsDate(hactual.Range("A1")) Then
MsgBox "Ingresar Una Fecha Valida En La Celda: A1", vbCritical, "Crear planilla"
Range("A1").Select
Exit Sub
End If
'Fin de insertar líneas

ufila = Range("A" & Rows.Count).End(xlUp).Row

Saludos. Dam
Si es lo que necesitas.

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas