ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Property of a cell with a string (https://www.excelbanter.com/excel-programming/444161-property-cell-string.html)

Slim Slender[_3_]

Property of a cell with a string
 
If .Cells(myRow, myColumn).???? = "String"
Then

What property of cells do I need here? Value gives an error.
Auto List Members, List properties/Methods won't work for me. They are
turned on in Options but I can't get any help.

GS[_2_]

Property of a cell with a string
 
After serious thinking Slim Slender wrote :
If .Cells(myRow, myColumn).???? = "String"
Then

What property of cells do I need here? Value gives an error.
Auto List Members, List properties/Methods won't work for me. They are
turned on in Options but I can't get any help.


..Value is default; .Text may be an option; -neither are needed here!

Try using a var to put the cell contents into, then test the var.

Dim vTemp As Variant

'Get the cell contents
vTemp = Cells(myRow, myColumn)

'Test the cell contents
If vTemp = "String" Then...

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc



Jim Cone[_2_]

Property of a cell with a string
 

Try this with text in B5 and with a number in B5 Then run it with and without ".Value"
....
Don't place any bets ahead of time. <g
'---
Sub xyz()
Dim myType As String
myType = TypeName(Cells(5, 2).Value)

If myType = "String" Then
MsgBox myType
Else
MsgBox "Not a string, it is a " & myType
End If
End Sub
--
Jim Cone
Portland, Oregon USA
http://www.mediafire.com/PrimitiveSoftware
(Extras for Excel add-in: convenience built-in)





"Slim Slender"
wrote in message
...
If .Cells(myRow, myColumn).???? = "String"
Then

What property of cells do I need here? Value gives an error.
Auto List Members, List properties/Methods won't work for me. They are
turned on in Options but I can't get any help.




Slim Slender[_3_]

Property of a cell with a string
 
Thanks for the responses. Turned out all I had to do was specify the
column.

If .Cells(myRow, myColumn).Value = "String" Then doesn't
work, but

If .Cells(myRow, 5).Value = "String" Then works just
fine.

This is what I wanted in the first place but I was working with cloned
code
and hadn't completely adapted it.


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com