ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   Help with entering text in a macro. (https://www.excelbanter.com/new-users-excel/140157-help-entering-text-macro.html)

ann

Help with entering text in a macro.
 
As part of an existing macro I want to add quite a lot of text in rows 1 to 13.

The way I am achieving this is using:-

ActiveSheet.Cells(1, 1).Value = "insert text here to appear in row 1 column
1, the value of cell A15 is€

ActiveSheet.Cells(2, 1).Value = "insert text here to appear in row 2 column
1€

As part of the above I want to display the content of cell A15 at the end of
the text in row 1 column 1. I have written the following:-

ActiveSheet.Cells(1, 1).Value = "insert text here to appear in row 1 column
1, the value of cell A15 is€ &A15.

The problem I have is that the text is inserted in row 1 column 1, but the
contents of A15 are not displayed. Can someone please advise why the contents
of A15 are not displayed?

Additionally, is there a better way than above to populate cells with text
as part of a macro?

--
Thank U and Regards

Ann


Duke Carey

Help with entering text in a macro.
 
instead of simply using A15, try

Range("A15").value


"Ann" wrote:

As part of an existing macro I want to add quite a lot of text in rows 1 to 13.

The way I am achieving this is using:-

ActiveSheet.Cells(1, 1).Value = "insert text here to appear in row 1 column
1, the value of cell A15 is€

ActiveSheet.Cells(2, 1).Value = "insert text here to appear in row 2 column
1€

As part of the above I want to display the content of cell A15 at the end of
the text in row 1 column 1. I have written the following:-

ActiveSheet.Cells(1, 1).Value = "insert text here to appear in row 1 column
1, the value of cell A15 is€ &A15.

The problem I have is that the text is inserted in row 1 column 1, but the
contents of A15 are not displayed. Can someone please advise why the contents
of A15 are not displayed?

Additionally, is there a better way than above to populate cells with text
as part of a macro?

--
Thank U and Regards

Ann


ann

Help with entering text in a macro.
 
Duke,

Coded the line as :-


ActiveSheet.Cells(1, 1).Value = "insert text here to appear in row 1 column
1, the value of cell A15 is€ Range("A15").value

and I get a Compile Error saying Expected : End of statement with the word
Range highlighted.
Also tried a dot (.) in front of the Range, and I get the same result.

Any ideas how I can code it?





--
Thank U and Regards

Ann



"Duke Carey" wrote:

instead of simply using A15, try

Range("A15").value


"Ann" wrote:

As part of an existing macro I want to add quite a lot of text in rows 1 to 13.

The way I am achieving this is using:-

ActiveSheet.Cells(1, 1).Value = "insert text here to appear in row 1 column
1, the value of cell A15 is€

ActiveSheet.Cells(2, 1).Value = "insert text here to appear in row 2 column
1€

As part of the above I want to display the content of cell A15 at the end of
the text in row 1 column 1. I have written the following:-

ActiveSheet.Cells(1, 1).Value = "insert text here to appear in row 1 column
1, the value of cell A15 is€ &A15.

The problem I have is that the text is inserted in row 1 column 1, but the
contents of A15 are not displayed. Can someone please advise why the contents
of A15 are not displayed?

Additionally, is there a better way than above to populate cells with text
as part of a macro?

--
Thank U and Regards

Ann


Duke Carey

Help with entering text in a macro.
 
try an ampersand before the Range("A15").value

ActiveSheet.Cells(1, 1).Value = "insert text here to appear in row 1 column
1, the value of cell A15 is " & Range("A15").Value

"Ann" wrote:

Duke,

Coded the line as :-


ActiveSheet.Cells(1, 1).Value = "insert text here to appear in row 1 column
1, the value of cell A15 is€ Range("A15").value

and I get a Compile Error saying Expected : End of statement with the word
Range highlighted.
Also tried a dot (.) in front of the Range, and I get the same result.

Any ideas how I can code it?





--
Thank U and Regards

Ann



"Duke Carey" wrote:

instead of simply using A15, try

Range("A15").value


"Ann" wrote:

As part of an existing macro I want to add quite a lot of text in rows 1 to 13.

The way I am achieving this is using:-

ActiveSheet.Cells(1, 1).Value = "insert text here to appear in row 1 column
1, the value of cell A15 is€

ActiveSheet.Cells(2, 1).Value = "insert text here to appear in row 2 column
1€

As part of the above I want to display the content of cell A15 at the end of
the text in row 1 column 1. I have written the following:-

ActiveSheet.Cells(1, 1).Value = "insert text here to appear in row 1 column
1, the value of cell A15 is€ &A15.

The problem I have is that the text is inserted in row 1 column 1, but the
contents of A15 are not displayed. Can someone please advise why the contents
of A15 are not displayed?

Additionally, is there a better way than above to populate cells with text
as part of a macro?

--
Thank U and Regards

Ann


ann

Help with entering text in a macro.
 
Duke,

Thank you worked as wanted.
--
Thank U and Regards

Ann



"Duke Carey" wrote:

try an ampersand before the Range("A15").value

ActiveSheet.Cells(1, 1).Value = "insert text here to appear in row 1 column
1, the value of cell A15 is " & Range("A15").Value

"Ann" wrote:

Duke,

Coded the line as :-


ActiveSheet.Cells(1, 1).Value = "insert text here to appear in row 1 column
1, the value of cell A15 is€ Range("A15").value

and I get a Compile Error saying Expected : End of statement with the word
Range highlighted.
Also tried a dot (.) in front of the Range, and I get the same result.

Any ideas how I can code it?





--
Thank U and Regards

Ann



"Duke Carey" wrote:

instead of simply using A15, try

Range("A15").value


"Ann" wrote:

As part of an existing macro I want to add quite a lot of text in rows 1 to 13.

The way I am achieving this is using:-

ActiveSheet.Cells(1, 1).Value = "insert text here to appear in row 1 column
1, the value of cell A15 is€

ActiveSheet.Cells(2, 1).Value = "insert text here to appear in row 2 column
1€

As part of the above I want to display the content of cell A15 at the end of
the text in row 1 column 1. I have written the following:-

ActiveSheet.Cells(1, 1).Value = "insert text here to appear in row 1 column
1, the value of cell A15 is€ &A15.

The problem I have is that the text is inserted in row 1 column 1, but the
contents of A15 are not displayed. Can someone please advise why the contents
of A15 are not displayed?

Additionally, is there a better way than above to populate cells with text
as part of a macro?

--
Thank U and Regards

Ann



All times are GMT +1. The time now is 09:14 PM.

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