|
|
MsgBox when the cell is empty
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
|
|
0
|
|
|
|
Reply
|
Utf
|
1/19/2010 12:51:02 PM |
|
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
|
|
0
|
|
|
|
Reply
|
Utf
|
1/19/2010 12:58:01 PM
|
|
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
|
|
0
|
|
|
|
Reply
|
Utf
|
1/19/2010 1:02:01 PM
|
|
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]
|
|
0
|
|
|
|
Reply
|
Simon
|
1/19/2010 1:07:54 PM
|
|
|
3 Replies
288 Views
(page loaded in 0.271 seconds)
|
|
|
|
|
|
|
|
|