From: Mia on
Hi,

I want a msgBox when a cell i empty,
I can´t get the cod to work, do anyone
know how to do this?

My code are

Dim Period As Date
Period = ActiveSheet.Range("b3")

If Period="" Then
MsgBox "Du har glömt att välja sorteringsperiod", vbCritical

Exit Sub


--
Best regards
Mia
From: Jacob Skaria on
Try

Dim Period As Date
If ActiveSheet.Range("b3") = "" Then
MsgBox "Du har glömt att välja sorteringsperiod", vbCritical
Exit Sub
Else
Period = ActiveSheet.Range("b3")
End If

--
Jacob


"Mia" wrote:

> Hi,
>
> I want a msgBox when a cell i empty,
> I can´t get the cod to work, do anyone
> know how to do this?
>
> My code are
>
> Dim Period As Date
> Period = ActiveSheet.Range("b3")
>
> If Period="" Then
> MsgBox "Du har glömt att välja sorteringsperiod", vbCritical
>
> Exit Sub
>
>
> --
> Best regards
> Mia
From: Mia on
Thank you so much!!!


--
Best regards
Mia


"Jacob Skaria" skrev:

> Try
>
> Dim Period As Date
> If ActiveSheet.Range("b3") = "" Then
> MsgBox "Du har glömt att välja sorteringsperiod", vbCritical
> Exit Sub
> Else
> Period = ActiveSheet.Range("b3")
> End If
>
> --
> Jacob
>
>
> "Mia" wrote:
>
> > Hi,
> >
> > I want a msgBox when a cell i empty,
> > I can´t get the cod to work, do anyone
> > know how to do this?
> >
> > My code are
> >
> > Dim Period As Date
> > Period = ActiveSheet.Range("b3")
> >
> > If Period="" Then
> > MsgBox "Du har glömt att välja sorteringsperiod", vbCritical
> >
> > Exit Sub
> >
> >
> > --
> > Best regards
> > Mia
From: Simon Lloyd on

You need to put the code in the activsheet code module or in the sheet
code module for the sheet you are working on.

Mia;616610 Wrote:
> Hi,
>
> I want a msgBox when a cell i empty,
> I can´t get the cod to work, do anyone
> know how to do this?
>
> My code are
>
> Dim Period As Date
> Period = ActiveSheet.Range("b3")
>
> If Period="" Then
> MsgBox "Du har glömt att välja sorteringsperiod", vbCritical
>
> Exit Sub
>
>
> --
> Best regards
> Mia


--
Simon Lloyd

Regards,
Simon Lloyd
'Microsoft Office Help' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: 1
View this thread: http://www.thecodecage.com/forumz/showthread.php?t=171308

[url="http://www.thecodecage.com"]Microsoft Office Help[/url]