Text in a cell visable on screen but BUT doesn't get printed

T.I.M.

New Member
Joined
Apr 9, 2004
Messages
32
[Fixed]
How can I show the 1st 3 rows off the ,,first'' worksheet, on each new worksheet?

So it's some sort of Header?
[Fixed]


And another question:
How can I enter text in a cell that I can see on screen but doesn't get printed?
I don't like that comment thing in Excel, because you only see the/that comment when the corresponding cell is active.



great thanks,
Tim
 
Re: Text in a cell visable on screen but BUT doesn't get pri

It's doesn't do anything???

I Use the DUTCH version of Excel 2002 with Windows XP Pro
 
Upvote 0

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Re: Text in a cell visable on screen but BUT doesn't get pri

If the name of your TextBox is not TextBox1, you will need to change that reference in the code.
Right Click on the sheet name tab for the sheet that the text box is on. Click on View Code. Paste this code in the white area:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Or Target.Address = "$B$1" Then
myrange = ActiveSheet.Range("A1:B1")
TextBox1.Text = Application.WorksheetFunction.Sum(myrange)
End If
End Sub
 
Upvote 0
Re: Text in a cell visable on screen but BUT doesn't get pri

As far as protecting it, try this:

In the Worksheet section for the sheet that the text box is on:

Private Sub TextBox1_GotFocus()
TextBox1.Enabled = False
End Sub

Private Sub TextBox1_LostFocus()
TextBox1.Enabled = True
End Sub

In the ThisWorbook section:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Worksheets("Sheet1").TextBox1.Enabled = True
End Sub

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Worksheets("Sheet1").TextBox1.Enabled = True
End Sub
 
Upvote 0
Re: Text in a cell visable on screen but BUT doesn't get pri

HOTPEPPER said:
If the name of your TextBox is not TextBox1, you will need to change that reference in the code.
Right Click on the sheet name tab for the sheet that the text box is on. Click on View Code. Paste this code in the white area:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Or Target.Address = "$B$1" Then
myrange = ActiveSheet.Range("A1:B1")
TextBox1.Text = Application.WorksheetFunction.Sum(myrange)
End If
End Sub


The textbox still doesn't show anything???
=> empty...the textbox is just white?

Code:
Private Sub TextBox1_Change()
End Sub
this one is auto-created => delete? or keep it empty?
 
Upvote 0
Re: Text in a cell visable on screen but BUT doesn't get pri

You can delete this:

Code:
Private Sub TextBox1_Change() 
End Sub

Make sure that this code is in the Worksheet section for the sheet that the text box is on and that you are not in design mode, when you try it. The value in the textbox should change when you type values into A1 or B1.

Code:
Private Sub Worksheet_Change(ByVal Target As Range) 
If Target.Address = "$A$1" Or Target.Address = "$B$1" Then 
myrange = ActiveSheet.Range("A1:B1") 
TextBox1.Text = Application.WorksheetFunction.Sum(myrange) 
End If 
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,642
Messages
6,173,510
Members
452,518
Latest member
SoerenB

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top