ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Code to insert text (https://www.excelbanter.com/excel-programming/295007-code-insert-text.html)

gav meredith

Code to insert text
 
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 C11 then D1 should read 'Inc'. I am in
urgent need of this so any help is appreciated!!!

cheers!!!



Anders S[_2_]

Code to insert text
 
Enter in D1

=IF(C11,"Inc","")

Then fill down.

HTH
Anders Silven

"gav meredith" skrev i meddelandet ...
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 C11 then D1 should read 'Inc'. I am in
urgent need of this so any help is appreciated!!!

cheers!!!



gav meredith

Code to insert text
 
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!!!
"Anders S" wrote in message
...
Enter in D1

=IF(C11,"Inc","")

Then fill down.

HTH
Anders Silven

"gav meredith" skrev i meddelandet
...
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 C11 then D1 should read 'Inc'. I am in
urgent need of this so any help is appreciated!!!

cheers!!!





Chris

Code to insert text
 
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!!!
"Anders S" wrote in message
...
Enter in D1

=IF(C11,"Inc","")

Then fill down.

HTH
Anders Silven

"gav meredith" skrev i meddelandet
...
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 C11 then D1 should read 'Inc'. I am in
urgent need of this so any help is appreciated!!!
cheers!!!



All times are GMT +1. The time now is 10:30 AM.

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