Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
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 |
#4
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
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 |
#5
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
entering text | Excel Discussion (Misc queries) | |||
Can a macro be made to run on entering or leaving a cell? | Excel Discussion (Misc queries) | |||
Entering Time Macro | Excel Worksheet Functions | |||
Macro entering data into a protected Cell?? | Excel Discussion (Misc queries) | |||
macro for "entering data" | Excel Worksheet Functions |