lm8
12-08-2016, 02:32 PM
Hi there,
So I feel like this has to be a simple solution that I'm just missing. I've sifted through a lot of forums and Google results and still haven't found it.
I'm using Microsoft Excel 2010. I have 2 sheets, Sheet 1 "Editable" (the editable copy of the form) & Sheet 2 "Printable" (the print friendly copy of the form). When text is typed into a cell on "Editable", the text should automatically populate to a textbox on "Printable".
I wasn't sure where to put the code, so I put it under the Worksheet_Change sub on "Printable". It will automatically update, but only with changes to "Printable". I would like it so it automatically updates whenever text is entered into "Editable".
Here is the VBA code for the "Printable" sheet:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myArray As Variant
Dim myStr As String
Dim x As Long
Dim myArray2 As Variant
Dim myStr2 As String
Dim y As Long
txtTime.Text = Format("MM/dd/yyyy hh:mm:ss AM/PM")
'for comments
myArray = Worksheets("Editable").Range("J15:J62").Value
For x = LBound(myArray, 1) To UBound(myArray, 1)
myStr = myStr & myArray(x, 1) & vbCrLf
Next x
'TextBox267 = myStr
txtComments = myStr
'for time stamps
myArray2 = Worksheets("Editable").Range("K15: K62").Value
For y = LBound(myArray2, 1) To UBound(myArray2, 1)
myStr2 = myStr2 & myArray2(y, 1) & vbCrLf
Next y
txtTime = myStr2
End Sub
Is there a better subroutine to place this in or something else that I'm missing?
Thanks in advance for any assistance! :)
So I feel like this has to be a simple solution that I'm just missing. I've sifted through a lot of forums and Google results and still haven't found it.
I'm using Microsoft Excel 2010. I have 2 sheets, Sheet 1 "Editable" (the editable copy of the form) & Sheet 2 "Printable" (the print friendly copy of the form). When text is typed into a cell on "Editable", the text should automatically populate to a textbox on "Printable".
I wasn't sure where to put the code, so I put it under the Worksheet_Change sub on "Printable". It will automatically update, but only with changes to "Printable". I would like it so it automatically updates whenever text is entered into "Editable".
Here is the VBA code for the "Printable" sheet:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myArray As Variant
Dim myStr As String
Dim x As Long
Dim myArray2 As Variant
Dim myStr2 As String
Dim y As Long
txtTime.Text = Format("MM/dd/yyyy hh:mm:ss AM/PM")
'for comments
myArray = Worksheets("Editable").Range("J15:J62").Value
For x = LBound(myArray, 1) To UBound(myArray, 1)
myStr = myStr & myArray(x, 1) & vbCrLf
Next x
'TextBox267 = myStr
txtComments = myStr
'for time stamps
myArray2 = Worksheets("Editable").Range("K15: K62").Value
For y = LBound(myArray2, 1) To UBound(myArray2, 1)
myStr2 = myStr2 & myArray2(y, 1) & vbCrLf
Next y
txtTime = myStr2
End Sub
Is there a better subroutine to place this in or something else that I'm missing?
Thanks in advance for any assistance! :)