Code to insert text

  • Thread starter Thread starter gav meredith
  • Start date Start date
G

gav meredith

Hi all,

I am after a code that inserts the text 'Inc' into a cell if the cell next
to it is greater than 1. ie: if C1>1 then D1 should read 'Inc'. I am in
urgent need of this so any help is appreciated!!!

cheers!!!
 
hi anders, thank you but with this, if the content of this cell is deleted,
wont the formula delete also?? This is what i am trying to avoid. Any other
suggestions would be great!!!
Enter in D1

=IF(C1>1,"Inc","")

Then fill down.

HTH
Anders Silven
 
You could do it as a macro but it has to be overtly run by a button, a call, or an event

Dim MyRange as Range, c as Range, x as integer
set MyRange = columns(x) "where x is the column # you want to use as the source"

For each c in MyRange
if c.value = "" then Exit For " This assumes your data is contiguous. One missing value and the loop ends"
if c.value >1 then c.offset(0,1).value = "inc." update the value of the cell over to the right
Next c

----- gav meredith wrote: -----

hi anders, thank you but with this, if the content of this cell is deleted,
wont the formula delete also?? This is what i am trying to avoid. Any other
suggestions would be great!!!
Enter in D1

=IF(C1>1,"Inc","")

Then fill down.

HTH
Anders Silven
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top