View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
[email protected] brotherescott@yahoo.com is offline
external usenet poster
 
Posts: 18
Default Determine the text in a range that covers several cells


Mark wrote:
Sub Test()
'LName is the combined range on the worksheet of cells A1 to A3
Worksheets("Sheet1").Range("LName") = "Anderson"
'Test to see what "LName" is
If Worksheets("Sheet1").Range(LName).FormulaR1C1 < "" Then MsgBox
"Yes"
If Worksheets("Sheet1").Range(LName).Value < "" Then MsgBox "Yes"
If Worksheets("Sheet1").Range(LName).Text < "" Then MsgBox "Yes"
If Worksheets("Sheet1").Range("LName").FormulaR1C1 < "" Then
MsgBox "Yes"
If Worksheets("Sheet1").Range("LName").Value < "" Then MsgBox
"Yes"
If Worksheets("Sheet1").Range("LName").Text(1) < "" Then MsgBox
"Yes"
End Sub



Because of the inconsistency in your code, I am having a difficult time
trying to understand what you are trying to accomplish. Sometimes you
refer to your NamedRange as Range(LName), other times it is
Range("LName"). Which is it?
Range(LName) would refer to a variable, in other words you would have
had to do something like this earlier in your code...

Dim LName as Range
Set LName = Application.ActiveCell

Range("LName") on the other hand would refer to a NamedRange. I am
guessing that is what you mean based on what you said, but you better
fix the syntax in your code first before you continue asking questions.
That alone may fix your problem, check it out.



The code I have shown is what I have tried and not been successfull
with. I just gave it as a example. I know that it is wrong.
It seems that when refering to a range that spans multiple cells you
have to approach it differently?
Thanks
Scott