Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default Add text based on imput in another cell

Based on value in C15 I want to have a text statement added to cell B21. I
would like this to be put at the end of whatever is already in B21 - not
just replace the cell content.

Need help with the code - and where it would go.

Thanks



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Add text based on imput in another cell

You posted in the Excel Programming section, but I don't think you need a
macro to do what you described. Put this function in an appropriate cell:
=IF(C1515,B21&C21,"")

Regards,
Ryan---

--
RyGuy


"HH" wrote:

Based on value in C15 I want to have a text statement added to cell B21. I
would like this to be put at the end of whatever is already in B21 - not
just replace the cell content.

Need help with the code - and where it would go.

Thanks




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Add text based on imput in another cell

Let say tht B21 originally contained:
=B19+B20
change this to:
=IF(C15=1,(B19+B20) & " and C15 has a one",B19+B20)
--
Gary''s Student - gsnu200782


"HH" wrote:

Based on value in C15 I want to have a text statement added to cell B21. I
would like this to be put at the end of whatever is already in B21 - not
just replace the cell content.

Need help with the code - and where it would go.

Thanks




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default Add text based on imput in another cell

Maybe I was not clear enough - or maybe I don't understand. I'll try
again..

If I put a value less than 1980 in cell C17, I would like a text statement
added to cell C21. This added text statement would say "Construction
material may contain lead." There may already be a text statement in C21 so
the new statement would be added at the end of whatever is already in the
cell.
What I have come up with is: =If (C171980,C21="Construction material may
contain lead.","") I think this would delete whatever is already in C21
and replace the Consturction material...statement. But even if it would
work - I don't know where to add the =if statement.
Thanks

"HH" wrote in message
...
Based on value in C15 I want to have a text statement added to cell B21.
I would like this to be put at the end of whatever is already in B21 - not
just replace the cell content.

Need help with the code - and where it would go.

Thanks





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Add text based on imput in another cell

If you don't mind updating the whole worksheet as a batch, you can create a
button and then use something similar to the following code to loop thru all
cells:

Private Sub CommandButton1_Click()
Dim oRange As Range
Dim sTest As String
Dim iCount As Integer
Dim i As Integer

With Sheets("Sheet1")
Debug.Print .Cells(.Rows.Count, "A").End(xlUp).Row
For i = 1 To .Cells(.Rows.Count, "A").End(xlUp).Row
If .Range("A" & i).Value < "" Then
If .Range("A" & i).Value < 1870 Then
.Range("B" & i).Value = .Range("B" & i).Value & " - may contain
lead"
End If
End If
Next
End With
End Sub

You may have to change the columns above as I am just using A & B for example.



"HH" wrote:

Maybe I was not clear enough - or maybe I don't understand. I'll try
again..

If I put a value less than 1980 in cell C17, I would like a text statement
added to cell C21. This added text statement would say "Construction
material may contain lead." There may already be a text statement in C21 so
the new statement would be added at the end of whatever is already in the
cell.
What I have come up with is: =If (C171980,C21="Construction material may
contain lead.","") I think this would delete whatever is already in C21
and replace the Consturction material...statement. But even if it would
work - I don't know where to add the =if statement.
Thanks

"HH" wrote in message
...
Based on value in C15 I want to have a text statement added to cell B21.
I would like this to be put at the end of whatever is already in B21 - not
just replace the cell content.

Need help with the code - and where it would go.

Thanks








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Add text based on imput in another cell

What is in C21 now? By that I mean, does it contain a formula which displays
text (if so, tell us the formula) or does it contain text typed in by the
user?

Rick


"HH" wrote in message
...
Maybe I was not clear enough - or maybe I don't understand. I'll try
again..

If I put a value less than 1980 in cell C17, I would like a text
statement added to cell C21. This added text statement would say
"Construction material may contain lead." There may already be a text
statement in C21 so the new statement would be added at the end of
whatever is already in the cell.
What I have come up with is: =If (C171980,C21="Construction material may
contain lead.","") I think this would delete whatever is already in C21
and replace the Consturction material...statement. But even if it would
work - I don't know where to add the =if statement.
Thanks

"HH" wrote in message
...
Based on value in C15 I want to have a text statement added to cell B21.
I would like this to be put at the end of whatever is already in B21 -
not just replace the cell content.

Need help with the code - and where it would go.

Thanks






  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default Add text based on imput in another cell

Rick,
C21 is a general text cell where the user can type comments. There is no
formula in this cell now.

"Rick Rothstein (MVP - VB)" wrote in
message ...
What is in C21 now? By that I mean, does it contain a formula which
displays text (if so, tell us the formula) or does it contain text typed
in by the user?

Rick


"HH" wrote in message
...
Maybe I was not clear enough - or maybe I don't understand. I'll try
again..

If I put a value less than 1980 in cell C17, I would like a text
statement added to cell C21. This added text statement would say
"Construction material may contain lead." There may already be a text
statement in C21 so the new statement would be added at the end of
whatever is already in the cell.
What I have come up with is: =If (C171980,C21="Construction material may
contain lead.","") I think this would delete whatever is already in
C21 and replace the Consturction material...statement. But even if it
would work - I don't know where to add the =if statement.
Thanks

"HH" wrote in message
...
Based on value in C15 I want to have a text statement added to cell
B21. I would like this to be put at the end of whatever is already in
B21 - not just replace the cell content.

Need help with the code - and where it would go.

Thanks








  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Add text based on imput in another cell

If the user can type into the cell, then you cannot put a formula in the
cell also (it will be overwritten by the user's entry). The only way to do
what you want is through an event procedure. In order to give you the code
you will need, we need some more information. Are you interested in cells
C17 and C21 only? Or is this a functionality you need across multiple
columns? If multiple columns, which ones (start column, end column)? Always
rows 17 and 21, or do other rows need to react to the value typed into C17?

Rick


"HH" wrote in message
. ..
Rick,
C21 is a general text cell where the user can type comments. There is no
formula in this cell now.

"Rick Rothstein (MVP - VB)" wrote in
message ...
What is in C21 now? By that I mean, does it contain a formula which
displays text (if so, tell us the formula) or does it contain text typed
in by the user?

Rick


"HH" wrote in message
...
Maybe I was not clear enough - or maybe I don't understand. I'll try
again..

If I put a value less than 1980 in cell C17, I would like a text
statement added to cell C21. This added text statement would say
"Construction material may contain lead." There may already be a text
statement in C21 so the new statement would be added at the end of
whatever is already in the cell.
What I have come up with is: =If (C171980,C21="Construction material
may contain lead.","") I think this would delete whatever is already
in C21 and replace the Consturction material...statement. But even if
it would work - I don't know where to add the =if statement.
Thanks

"HH" wrote in message
...
Based on value in C15 I want to have a text statement added to cell
B21. I would like this to be put at the end of whatever is already in
B21 - not just replace the cell content.

Need help with the code - and where it would go.

Thanks









  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default Add text based on imput in another cell

Rick,
Yes, C17 and C21 are the only cells involved. What I want to do is add the
staement "Construction material may contain lead." to C21 if a year less
than 1980 is entered in C17.
You are right, there may be other text already in the cell when the
statement is to be added. Also there may be text added to C21 after the
statement is added.
"Rick Rothstein (MVP - VB)" wrote in
message ...
If the user can type into the cell, then you cannot put a formula in the
cell also (it will be overwritten by the user's entry). The only way to do
what you want is through an event procedure. In order to give you the code
you will need, we need some more information. Are you interested in cells
C17 and C21 only? Or is this a functionality you need across multiple
columns? If multiple columns, which ones (start column, end column)?
Always rows 17 and 21, or do other rows need to react to the value typed
into C17?

Rick


"HH" wrote in message
. ..
Rick,
C21 is a general text cell where the user can type comments. There is
no formula in this cell now.

"Rick Rothstein (MVP - VB)" wrote
in message ...
What is in C21 now? By that I mean, does it contain a formula which
displays text (if so, tell us the formula) or does it contain text typed
in by the user?

Rick


"HH" wrote in message
...
Maybe I was not clear enough - or maybe I don't understand. I'll try
again..

If I put a value less than 1980 in cell C17, I would like a text
statement added to cell C21. This added text statement would say
"Construction material may contain lead." There may already be a text
statement in C21 so the new statement would be added at the end of
whatever is already in the cell.
What I have come up with is: =If (C171980,C21="Construction material
may contain lead.","") I think this would delete whatever is already
in C21 and replace the Consturction material...statement. But even if
it would work - I don't know where to add the =if statement.
Thanks

"HH" wrote in message
...
Based on value in C15 I want to have a text statement added to cell
B21. I would like this to be put at the end of whatever is already in
B21 - not just replace the cell content.

Need help with the code - and where it would go.

Thanks











Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't choose an imput cell for my data table in another worksheet Rick Excel Discussion (Misc queries) 1 October 14th 07 08:36 AM
select text in cell based on text from another cell, paste the text at the begining of a thrid cell, etc... jsd219 Excel Programming 0 October 19th 06 05:04 PM
format text in imput box Rich Excel Programming 2 August 24th 06 12:56 PM
Is there a way of making data imput in to a cell mandatory before. TerryM Excel Worksheet Functions 0 February 15th 05 11:25 AM
Deleting Rows based on text in cell & formatting cell based on text in column beside it Steve Excel Programming 4 February 26th 04 03:31 PM


All times are GMT +1. The time now is 04:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"