Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 345
Default Val function with contents of a Hyperlinked cell

Hi All,
Why does a cell with a text value fail the Val function?

Background:
c1 holds 44 1st Sub Row as its value AND is hyperlinked to a cell in row
44.
Rec is a user defined record and .FirSubRow is a long field.


With Ws 'stepping thru the code the Rec value was 44.
' line below did not work as expected
If Rec.FirSubRow < Val(.Range("c1").Value) Then

'Code here is working fine
End If
End With


This is code I put in front of the above to isolate the number leading the
string:

sHoldAy = split(LTrim(.Range("c1").Value), " ")
Lnum = Val(sHoldAy(0))

and, If Rec.FirSubRow < Lnum then .... worked. How come ?

The ornery thing about this, is that I have other code,
almost the same as the not-working line above, that DOES
WORK as expected, hmmm.... Make a function to do the split?

Thanks,
Neal
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Val function with contents of a Hyperlinked cell

Neal,
The Val function returns 441 from "44 1st Sub Row".
Is that what you expected?
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)


"Neal Zimm"
wrote in message
Hi All,
Why does a cell with a text value fail the Val function?

Background:
c1 holds 44 1st Sub Row as its value AND is hyperlinked to a cell in row
44.
Rec is a user defined record and .FirSubRow is a long field.
With Ws 'stepping thru the code the Rec value was 44.
' line below did not work as expected
If Rec.FirSubRow < Val(.Range("c1").Value) Then

'Code here is working fine
End If
End With
This is code I put in front of the above to isolate the number leading the string:

sHoldAy = split(LTrim(.Range("c1").Value), " ")
Lnum = Val(sHoldAy(0))

and, If Rec.FirSubRow < Lnum then .... worked. How come ?
The ornery thing about this, is that I have other code,
almost the same as the not-working line above, that DOES
WORK as expected, hmmm.... Make a function to do the split?
Thanks,
Neal
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Merging a hyperlinked cell with a non-hyperlinked cell? Alex Excel Discussion (Misc queries) 1 September 11th 08 03:14 PM
Trying to get contents of cell linked through IF function. bman1965 Excel Worksheet Functions 2 June 18th 08 07:53 PM
function to display contents of a cell Ronald Excel Worksheet Functions 2 January 18th 07 07:51 PM
use the contents of a cell in a function ... ?? LarryLev Excel Programming 4 November 30th 05 11:40 PM
Create a hyperlink to a hyperlinked cell using Vlookup function Joe questions in Excel Excel Programming 1 June 5th 05 09:40 AM


All times are GMT +1. The time now is 01:26 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"