Hi
Sub Macro1()
Dim myvar As String, mytext As String
'cell c6 contains the text "This bit"
myvar = Range("C6").Text
mytext = myvar & " Works " & Trim$(215) & " days each year"
Range("D15").Value = mytext
End Sub
This is the implemented & tested solution that Trevor gave you. Test run
before assuming that your helpers misunderstood everything.
However, you are using the spreadsheet just as a mean to get to the printer
? You could use a userform instead. In the
VB editor, Insert Userform. Put
a single Label onto it -it should by default be named Label1. Then run this:
Sub Macro2()
Dim myvar As String, mytext As String
'cell c6 contains the text "This bit"
myvar = Range("C6").Text
mytext = myvar & " Works " & Trim$(215) & " days each year"
UserForm1.Label1.Caption = mytext
DoEvents
UserForm1.PrintForm
DoEvents
Unload UserForm1
End Sub
HTH. Best wishes Harald
skrev i melding
...
-----Original Message-----
Tom
why copy and paste ?
what I need is to make a load of calculations and produce
a piece of text based on some fields in an Excel sheet. I
need to store this as a Macro so that it runs on the sheet
(which is replaced every hour) and the user can get a
report on the current figures.
I have it working as a msgbox, but I need to print it so I
thought the best way/ only way, was to stick it in a cell
and print that range. Due to network restricions I can not
use a VB program so it needs to ba an Excel macro.
It is not as simple as "the contents of one cell" into
another, it is "the result of some code" going into a cell.
If you can think of a way to print the contents of amsgbox
I'd be as happy as a pig in that stuff that pigs are happy
in.