Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Cells(1, 1) contains the value Annette Thompson How do I get the variable fName to = Annette? Any help at all will be much appreciated. -- Regards, David |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
one way: dim rng as range dim fname dim fullname dim pos as integer set rng = activesheet.cells(1,1) fullname=rng.value pos = instr(fullname, " ") if pos0 then fname=left(fullname,pos-1) else fname="" end if msgbox fname -----Original Message----- Hi, Cells(1, 1) contains the value Annette Thompson How do I get the variable fName to = Annette? Any help at all will be much appreciated. -- Regards, David . |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
one way: dim rng as range dim fname dim fullname dim pos as integer set rng = activesheet.cells(1,1) fullname=rng.value pos = instr(fullname, " ") if pos0 then fname=left(fullname,pos-1) else fname="" end if msgbox fname -----Original Message----- Hi, Cells(1, 1) contains the value Annette Thompson How do I get the variable fName to = Annette? Any help at all will be much appreciated. -- Regards, David . |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi David
fname = left(cells(1,1),instr(cells(1,1)," ")-1) Cheers JulieD "fitful_thought" wrote in message ... Hi, Cells(1, 1) contains the value Annette Thompson How do I get the variable fName to = Annette? Any help at all will be much appreciated. -- Regards, David |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks JulieD,
Works like a charm. -- Regards, David "JulieD" wrote in message ... Hi David fname = left(cells(1,1),instr(cells(1,1)," ")-1) Cheers JulieD "fitful_thought" wrote in message ... Hi, Cells(1, 1) contains the value Annette Thompson How do I get the variable fName to = Annette? Any help at all will be much appreciated. -- Regards, David |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
if you have xl2000 or later
fname = Split(Cells(1,1)," ")(0) -- Regards, Tom Ogilvy "fitful_thought" wrote in message ... Hi, Cells(1, 1) contains the value Annette Thompson How do I get the variable fName to = Annette? Any help at all will be much appreciated. -- Regards, David |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Tom,
I have 2002. Your method is very concise. Thank you. -- Regards, David "Tom Ogilvy" wrote in message ... if you have xl2000 or later fname = Split(Cells(1,1)," ")(0) -- Regards, Tom Ogilvy "fitful_thought" wrote in message ... Hi, Cells(1, 1) contains the value Annette Thompson How do I get the variable fName to = Annette? Any help at all will be much appreciated. -- Regards, David |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Assign value to a variable name | Excel Discussion (Misc queries) | |||
How to keep a Variable alive after a Call to Sub Routine | Excel Discussion (Misc queries) | |||
Assign value to variable | Excel Discussion (Misc queries) | |||
Variable VB to assign new sheet name | Excel Worksheet Functions | |||
Assign Formula to Variable | Excel Programming |