ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Add additional value to a cell (https://www.excelbanter.com/excel-programming/276280-add-additional-value-cell.html)

Rasmus[_2_]

Add additional value to a cell
 
Has anyone got a quick fix for this:

A1 has a value of "Subtitles:"

I'd like to make three macro's that, when run individually, ADDS their value
to A1.

Ie.

Macro 1 inserts the value "English"
Macro 2 inserts the value ", Spanish"
Macro 3 inserts the value ", French"

So if I run macro 1, A1 will then contain the value "Subtitles:English"
Then if I run macro 2, A1 will then contain the value "Subtitles:English,
Spanish"

I need to add maybe 10 different subtitle languages, so it must be a macro
that adds the additional subtitle to the cell.

Any ideas ?

Rasmus





Tom Ogilvy

Add additional value to a cell
 
Sub AddEnglish()
Range("A1").Value = Trim(Range("A1")) & " English"
End sub

Sub AddSpanish()
Range("A1").Value = Trim(Range("A1")) & ", Spanish"
End Sub

Sub AddFrench()
Range("A1").Value = Trim(Range("A1")) & ", French"
End Sub

and so forth.


Rasmus wrote in message
le.rogers.com...
Has anyone got a quick fix for this:

A1 has a value of "Subtitles:"

I'd like to make three macro's that, when run individually, ADDS their

value
to A1.

Ie.

Macro 1 inserts the value "English"
Macro 2 inserts the value ", Spanish"
Macro 3 inserts the value ", French"

So if I run macro 1, A1 will then contain the value "Subtitles:English"
Then if I run macro 2, A1 will then contain the value "Subtitles:English,
Spanish"

I need to add maybe 10 different subtitle languages, so it must be a macro
that adds the additional subtitle to the cell.

Any ideas ?

Rasmus







Henry[_4_]

Add additional value to a cell
 
Ooops!
Should be:
ActiveWorkbook.Sheets("Sheet1").Range("A1").Value = _
ActiveWorkbook.Sheets("Sheet1").Range("A1").Value & ": English"

HTH
Henry


"Tom Ogilvy" wrote in message
...
Text is a read only property of a range. You can't assign a value to

Text.

--
Regards,
Tom Ogilvy

Henry wrote in message
...
Rasmus

Macro 1

ActiveWorkbook.Sheets("Sheet1").Range("A1").Text = _
ActiveWorkbook.Sheets("Sheet1").Range("A1").Text & ": English"

Macro 2

ActiveWorkbook.Sheets("Sheet1").Range("A1").Text = _
ActiveWorkbook.Sheets("Sheet1").Range("A1").Text & ", Spanish"

Etc.

HTH
Henry

"Rasmus" wrote in message
le.rogers.com...
Has anyone got a quick fix for this:

A1 has a value of "Subtitles:"

I'd like to make three macro's that, when run individually, ADDS their

value
to A1.

Ie.

Macro 1 inserts the value "English"
Macro 2 inserts the value ", Spanish"
Macro 3 inserts the value ", French"

So if I run macro 1, A1 will then contain the value

"Subtitles:English"
Then if I run macro 2, A1 will then contain the value

"Subtitles:English,
Spanish"

I need to add maybe 10 different subtitle languages, so it must be a

macro
that adds the additional subtitle to the cell.

Any ideas ?

Rasmus












All times are GMT +1. The time now is 06:57 AM.

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