![]() |
must be too simple
Hi.
I've programmed A BIT in VB before, but never with Excel. And i'm really having trouble with a stupid thing. To indicate a cell to excel... I only want him to read the value of a cell! A sort of: If Main!A5= "CLS" Then .... .... End If How to I write this "Main!A5" ?? Thank you. Marie |
must be too simple
Marie
If Sheets("Main").Range("A5") = "CLS" Then Regards Trevor "Marie Lavoie" wrote in message ... Hi. I've programmed A BIT in VB before, but never with Excel. And i'm really having trouble with a stupid thing. To indicate a cell to excel... I only want him to read the value of a cell! A sort of: If Main!A5= "CLS" Then ... ... End If How to I write this "Main!A5" ?? Thank you. Marie |
must be too simple
Hi, Marie. Are you trying to read the value of the cell with Visual Basic,
or with an Excel VBA macro? Ed "Marie Lavoie" wrote in message ... Hi. I've programmed A BIT in VB before, but never with Excel. And i'm really having trouble with a stupid thing. To indicate a cell to excel... I only want him to read the value of a cell! A sort of: If Main!A5= "CLS" Then ... ... End If How to I write this "Main!A5" ?? Thank you. Marie |
must be too simple
Marie,
'Sheets("Main").Range("A5")', properly speaking, is a Range object (the cell), not a String (the text the cell displays). Using 'Sheets("Main").Range("A5") = "CLS"' relies on VBAs "default value" of the Range object to return the String value of the cell. Allowing VBA to determine whether to return the cell or the text the cell displays can be unreliable under some not-very-rare circumstances. I recommend that you be unambiguous and use 'Sheets("Main").Range("A5").Text' which always returns the text the cell displays and never returns the cell. Bob Kilmer "Trevor Shuttleworth" wrote in message ... Marie If Sheets("Main").Range("A5") = "CLS" Then Regards Trevor "Marie Lavoie" wrote in message ... Hi. I've programmed A BIT in VB before, but never with Excel. And i'm really having trouble with a stupid thing. To indicate a cell to excel... I only want him to read the value of a cell! A sort of: If Main!A5= "CLS" Then ... ... End If How to I write this "Main!A5" ?? Thank you. Marie |
All times are GMT +1. The time now is 06:19 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com