Hide certain information within a cell when printing

J

jeremy

Is it possible to hide certain digits when printing in excel?, for example the cell will show: A/O(1) but when viewing the printed version I would like the cell to show A/O
 
F

Frank Kabel

Hi
AFAIK this is not possible. You could create a macro which would do the
following:
- use a helper column which shows only the relevant part of your data
- hides the original column
- prints the sheet
- unhides the original column
- deletes the helper column
 
J

JE McGimpsey

One way:

Assuming 1) you want to hide everything after the first "(", 2) the cell
background colors are automatic (or white), and 3) the fonts are the
default color:


Public Sub HideAndPrint()
Dim rCell As Range
Dim rConvert As Range
Dim rPR As Range
Dim nPos As Long

On Error Resume Next
Set rPR = Range("Print_Area")
If rPR Is Nothing Then Set rPR = ActiveSheet.UsedRange
On Error GoTo 0
For Each rCell In rPR
With rCell
nPos = InStr(.Text, "(")
If nPos > 0 Then
If rConvert Is Nothing Then
Set rConvert = .Cells
Else
Set rConvert = Union(rConvert, .Cells)
End If
.Characters(nPos).Font.ColorIndex = 2
End If
End With
Next rCell
ActiveSheet.PrintOut
For Each rCell In rConvert
With rCell
.Characters(InStr(.Text, "(")).Font.ColorIndex = xlAutomatic
End With
Next rCell
End Sub
 
Top