View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Cell reference in VBA

Try

if range("Data").value = "000" then
(if it's really a string equal to 000)

or
if range("Data").value = 0 then
if it's really the number 0 that's formatted to show 3 digits)

Tami wrote:

i have a line of VBA code that asks if cell O1 is "000" then yada yada yada.
It looks like this:

If Cells(1, 15) = "000" Then

But if i insert a column somewhere to the left of column O, my code still
refers to cell O1 but needs to now refer to cell P1.

I've named the cell "data" and i tried
If Cells("data")="000" Then
but that didnt' work.
any other suggestions?


--

Dave Peterson