View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default Newbie with VBA for Excel

What if nothing is found??? Then it will crash... Try this...

dim rng as range

set rng = Sheets(1).Range("A4:F20").Find(What:=NumDpt, _
LookIn:=xlFormulas, LookAt:=xlWhole)

if not rng is nothing then Colonne =rng.address

--
HTH...

Jim Thomlinson


"echo---pscbro" wrote:

Hi,

Can anyone help me out with the integrity of this line (on execution,
Excel says "Object or bloc variable not defined"). However I have set
Option Explicit in my own learning session of VBA and it all my
variables have been declared. See line below:

Colonne =
ClasseurRepresentants.Sheets(1).Range("A4:F20").Fi nd(What:=NumDpt, _
LookIn:=xlFormulas, LookAt:=xlWhole).Address

Thanks in advance,

Pascal