View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default not sure what's happening

Labels are usually used in VBA as an escape exit in error conditions, and
usually placed near the end of a subroutine, where tidy-up code is entered.

To input a label, just enter

lab1:

on a line all by itself.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Alex H" wrote in message
...
IOamworking thru some learningmaterial and have the following code:

Sub Monthupdate()
m = Sheets("command").Cells(3, 1)
If (m = "January") Then
Sheets("Command").Cells(3, 1) = February
GoTo lab1:
End If

At this point the following message is displayed:-

<<...OLE_Obj...

It appears not to like the GoTo lab1:

I can't find any reference to lab1: before this point in the module, will
the label need defining? If so how is this done in VB?

If you have any suggestions they would be most appreciated.